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

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

Issue 6242010: Refactor away most of ExtensionRendererInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/callback.h" 7 #include "base/callback.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_tabs_module.h" 10 #include "chrome/browser/extensions/extension_tabs_module.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 &browser, NULL, &contents, NULL)) { 72 &browser, NULL, &contents, NULL)) {
73 return false; 73 return false;
74 } 74 }
75 } 75 }
76 76
77 DCHECK(browser); 77 DCHECK(browser);
78 DCHECK(contents); 78 DCHECK(contents);
79 79
80 // NOTE: This can give the wrong answer due to race conditions, but it is OK, 80 // NOTE: This can give the wrong answer due to race conditions, but it is OK,
81 // we check again in the renderer. 81 // we check again in the renderer.
82 const Extension* extension = GetExtension(); 82 if (!GetExtension()->CanExecuteScriptOnPage(
83 const std::vector<URLPattern> host_permissions = 83 contents->tab_contents()->GetURL(), NULL, &error_)) {
84 extension->host_permissions();
85 if (!Extension::CanExecuteScriptOnPage(
86 contents->tab_contents()->GetURL(),
87 extension->CanExecuteScriptEverywhere(),
88 &host_permissions,
89 NULL,
90 &error_)) {
91 return false; 84 return false;
92 } 85 }
93 86
94 if (script_info->HasKey(keys::kAllFramesKey)) { 87 if (script_info->HasKey(keys::kAllFramesKey)) {
95 if (!script_info->GetBoolean(keys::kAllFramesKey, &all_frames_)) 88 if (!script_info->GetBoolean(keys::kAllFramesKey, &all_frames_))
96 return false; 89 return false;
97 } 90 }
98 91
99 std::string code_string; 92 std::string code_string;
100 if (script_info->HasKey(keys::kCodeKey)) { 93 if (script_info->HasKey(keys::kCodeKey)) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 void ExecuteCodeInTabFunction::Observe(NotificationType type, 179 void ExecuteCodeInTabFunction::Observe(NotificationType type,
187 const NotificationSource& source, 180 const NotificationSource& source,
188 const NotificationDetails& details) { 181 const NotificationDetails& details) {
189 std::pair<int, bool>* result_details = 182 std::pair<int, bool>* result_details =
190 Details<std::pair<int, bool> >(details).ptr(); 183 Details<std::pair<int, bool> >(details).ptr();
191 if (result_details->first == request_id()) { 184 if (result_details->first == request_id()) {
192 SendResponse(result_details->second); 185 SendResponse(result_details->second);
193 Release(); // balanced in Execute() 186 Release(); // balanced in Execute()
194 } 187 }
195 } 188 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698