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

Side by Side Diff: chrome/browser/extensions/execute_code_in_tab_function.cc

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 2 Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/execute_code_in_tab_function.h" 5 #include "chrome/browser/extensions/execute_code_in_tab_function.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 SendResponse(success); 173 SendResponse(success);
174 174
175 Observe(NULL); 175 Observe(NULL);
176 Release(); // balanced in Execute() 176 Release(); // balanced in Execute()
177 } 177 }
178 178
179 void ExecuteCodeInTabFunction::DidLoadFile(bool success, 179 void ExecuteCodeInTabFunction::DidLoadFile(bool success,
180 const std::string& data) { 180 const std::string& data) {
181 std::string function_name = name(); 181 std::string function_name = name();
182 const Extension* extension = GetExtension(); 182 const extensions::Extension* extension = GetExtension();
183 183
184 // Check if the file is CSS and needs localization. 184 // Check if the file is CSS and needs localization.
185 if (success && 185 if (success &&
186 function_name == TabsInsertCSSFunction::function_name() && 186 function_name == TabsInsertCSSFunction::function_name() &&
187 extension != NULL && 187 extension != NULL &&
188 data.find(ExtensionMessageBundle::kMessageBegin) != std::string::npos) { 188 data.find(ExtensionMessageBundle::kMessageBegin) != std::string::npos) {
189 BrowserThread::PostTask( 189 BrowserThread::PostTask(
190 BrowserThread::FILE, FROM_HERE, 190 BrowserThread::FILE, FROM_HERE,
191 base::Bind(&ExecuteCodeInTabFunction::LocalizeCSS, this, 191 base::Bind(&ExecuteCodeInTabFunction::LocalizeCSS, this,
192 data, 192 data,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 bool success = ExtensionTabUtil::GetTabById( 247 bool success = ExtensionTabUtil::GetTabById(
248 execute_tab_id_, profile(), include_incognito(), &browser, NULL, 248 execute_tab_id_, profile(), include_incognito(), &browser, NULL,
249 &contents, NULL) && contents && browser; 249 &contents, NULL) && contents && browser;
250 250
251 if (!success) { 251 if (!success) {
252 SendResponse(false); 252 SendResponse(false);
253 return false; 253 return false;
254 } 254 }
255 255
256 const Extension* extension = GetExtension(); 256 const extensions::Extension* extension = GetExtension();
257 if (!extension) { 257 if (!extension) {
258 SendResponse(false); 258 SendResponse(false);
259 return false; 259 return false;
260 } 260 }
261 261
262 bool is_js_code = true; 262 bool is_js_code = true;
263 std::string function_name = name(); 263 std::string function_name = name();
264 if (function_name == TabsInsertCSSFunction::function_name()) { 264 if (function_name == TabsInsertCSSFunction::function_name()) {
265 is_js_code = false; 265 is_js_code = false;
266 } else if (function_name != TabsExecuteScriptFunction::function_name()) { 266 } else if (function_name != TabsExecuteScriptFunction::function_name()) {
(...skipping 10 matching lines...) Expand all
277 params.in_main_world = false; 277 params.in_main_world = false;
278 contents->web_contents()->GetRenderViewHost()->Send( 278 contents->web_contents()->GetRenderViewHost()->Send(
279 new ExtensionMsg_ExecuteCode( 279 new ExtensionMsg_ExecuteCode(
280 contents->web_contents()->GetRenderViewHost()->GetRoutingID(), 280 contents->web_contents()->GetRenderViewHost()->GetRoutingID(),
281 params)); 281 params));
282 282
283 Observe(contents->web_contents()); 283 Observe(contents->web_contents());
284 AddRef(); // balanced in OnExecuteCodeFinished() 284 AddRef(); // balanced in OnExecuteCodeFinished()
285 return true; 285 return true;
286 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698