Coding style changes

This commit is contained in:
Cheng Zhao 2017-12-05 11:50:06 +09:00
parent eaa4b71c24
commit 776e8afa2b
3 changed files with 13 additions and 11 deletions

View file

@ -681,15 +681,17 @@ void Session::CreateInterruptedDownload(const mate::Dictionary& options) {
}
void Session::AddPreload(const base::FilePath::StringType& preloadPath) {
g_preloads.push_back(preloadPath);
preloads_.push_back(preloadPath);
}
void Session::RemovePreload(const base::FilePath::StringType& preloadPath) {
g_preloads.erase(
std::remove(g_preloads.begin(), g_preloads.end(), preloadPath),
g_preloads.end());
preloads_.erase(
std::remove(preloads_.begin(), preloads_.end(), preloadPath),
preloads_.end());
}
std::vector<base::FilePath::StringType> Session::GetPreloads() {
return g_preloads;
std::vector<base::FilePath::StringType> Session::GetPreloads() const {
return preloads_;
}
v8::Local<v8::Value> Session::Cookies(v8::Isolate* isolate) {

View file

@ -84,7 +84,7 @@ class Session: public mate::TrackableObject<Session>,
void CreateInterruptedDownload(const mate::Dictionary& options);
void AddPreload(const base::FilePath::StringType& preloadPath);
void RemovePreload(const base::FilePath::StringType& preloadPath);
std::vector<base::FilePath::StringType> GetPreloads();
std::vector<base::FilePath::StringType> GetPreloads() const;
v8::Local<v8::Value> Cookies(v8::Isolate* isolate);
v8::Local<v8::Value> Protocol(v8::Isolate* isolate);
v8::Local<v8::Value> WebRequest(v8::Isolate* isolate);
@ -107,7 +107,7 @@ class Session: public mate::TrackableObject<Session>,
std::string devtools_network_emulation_client_id_;
scoped_refptr<AtomBrowserContext> browser_context_;
std::vector<base::FilePath::StringType> g_preloads;
std::vector<base::FilePath::StringType> preloads_;
DISALLOW_COPY_AND_ASSIGN(Session);
};

View file

@ -141,10 +141,10 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
v8::Isolate* isolate = v8::Isolate::GetCurrent();
mate::Handle<atom::api::WebContents> api_web_contents =
atom::api::WebContents::CreateFrom(isolate, web_contents);
atom::api::WebContents::CreateFrom(isolate, web_contents);
auto session = atom::api::Session::CreateFrom(
isolate, api_web_contents.get()->GetBrowserContext());
for (auto preloadPath : session->GetPreloads()) {
isolate, api_web_contents.get()->GetBrowserContext());
for (const auto& preloadPath : session->GetPreloads()) {
if (base::FilePath(preloadPath).IsAbsolute())
command_line->AppendSwitchNative(switches::kSessionPreloadScript,
preloadPath);