Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: extensions/browser/web_ui_user_script_loader.cc

Issue 1150223003: Subsituting pattern ScopedVector push_back.(ptr.release()) with push_back(ptr.Pass()) in extensions… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/web_ui_user_script_loader.h" 5 #include "extensions/browser/web_ui_user_script_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/public/browser/browser_context.h" 9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 int render_view_id) { 109 int render_view_id) {
110 for (extensions::UserScript::File& file : *script_files) { 110 for (extensions::UserScript::File& file : *script_files) {
111 if (file.GetContent().empty()) { 111 if (file.GetContent().empty()) {
112 // The WebUIUserScriptLoader owns these WebUIURLFetchers. Once the 112 // The WebUIUserScriptLoader owns these WebUIURLFetchers. Once the
113 // loader is destroyed, all the fetchers will be destroyed. Therefore, 113 // loader is destroyed, all the fetchers will be destroyed. Therefore,
114 // we are sure it is safe to use base::Unretained(this) here. 114 // we are sure it is safe to use base::Unretained(this) here.
115 scoped_ptr<WebUIURLFetcher> fetcher(new WebUIURLFetcher( 115 scoped_ptr<WebUIURLFetcher> fetcher(new WebUIURLFetcher(
116 browser_context, render_process_id, render_view_id, file.url(), 116 browser_context, render_process_id, render_view_id, file.url(),
117 base::Bind(&WebUIUserScriptLoader::OnSingleWebUIURLFetchComplete, 117 base::Bind(&WebUIUserScriptLoader::OnSingleWebUIURLFetchComplete,
118 base::Unretained(this), &file))); 118 base::Unretained(this), &file)));
119 fetchers_.push_back(fetcher.release()); 119 fetchers_.push_back(fetcher.Pass());
120 } 120 }
121 } 121 }
122 } 122 }
123 123
124 void WebUIUserScriptLoader::OnSingleWebUIURLFetchComplete( 124 void WebUIUserScriptLoader::OnSingleWebUIURLFetchComplete(
125 extensions::UserScript::File* script_file, 125 extensions::UserScript::File* script_file,
126 bool success, 126 bool success,
127 const std::string& data) { 127 const std::string& data) {
128 if (success) { 128 if (success) {
129 // Remove BOM from the content. 129 // Remove BOM from the content.
(...skipping 12 matching lines...) Expand all
142 } 142 }
143 } 143 }
144 144
145 void WebUIUserScriptLoader::OnWebUIURLFetchComplete() { 145 void WebUIUserScriptLoader::OnWebUIURLFetchComplete() {
146 content::BrowserThread::PostTask( 146 content::BrowserThread::PostTask(
147 content::BrowserThread::FILE, FROM_HERE, 147 content::BrowserThread::FILE, FROM_HERE,
148 base::Bind(&SerializeOnFileThread, base::Passed(&user_scripts_cache_), 148 base::Bind(&SerializeOnFileThread, base::Passed(&user_scripts_cache_),
149 scripts_loaded_callback_)); 149 scripts_loaded_callback_));
150 scripts_loaded_callback_.Reset(); 150 scripts_loaded_callback_.Reset();
151 } 151 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698