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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_action_api.cc

Issue 527963003: Uncouple ActiveScriptController from LocationBarController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/api/extension_action/extension_action_api.h" 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/active_script_controller.h" 10 #include "chrome/browser/extensions/active_script_controller.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 browser->tab_strip_model()->GetActiveWebContents(); 168 browser->tab_strip_model()->GetActiveWebContents();
169 if (!web_contents) 169 if (!web_contents)
170 return ExtensionAction::ACTION_NONE; 170 return ExtensionAction::ACTION_NONE;
171 171
172 int tab_id = SessionTabHelper::IdForTab(web_contents); 172 int tab_id = SessionTabHelper::IdForTab(web_contents);
173 173
174 ActiveScriptController* active_script_controller = 174 ActiveScriptController* active_script_controller =
175 ActiveScriptController::GetForWebContents(web_contents); 175 ActiveScriptController::GetForWebContents(web_contents);
176 bool has_pending_scripts = false; 176 bool has_pending_scripts = false;
177 if (active_script_controller && 177 if (active_script_controller &&
178 active_script_controller->GetActionForExtension(extension)) { 178 active_script_controller->WantsToRun(extension)) {
179 has_pending_scripts = true; 179 has_pending_scripts = true;
180 } 180 }
181 181
182 // Grant active tab if appropriate. 182 // Grant active tab if appropriate.
183 if (grant_active_tab_permissions) { 183 if (grant_active_tab_permissions) {
184 TabHelper::FromWebContents(web_contents)->active_tab_permission_granter()-> 184 TabHelper::FromWebContents(web_contents)->active_tab_permission_granter()->
185 GrantIfRequested(extension); 185 GrantIfRequested(extension);
186 } 186 }
187 187
188 // If this was a request to run a script, it will have been run once active 188 // If this was a request to run a script, it will have been run once active
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || 642 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP ||
643 host->extension()->id() != extension_->id()) 643 host->extension()->id() != extension_->id())
644 return; 644 return;
645 645
646 SendResponse(true); 646 SendResponse(true);
647 response_sent_ = true; 647 response_sent_ = true;
648 registrar_.RemoveAll(); 648 registrar_.RemoveAll();
649 } 649 }
650 650
651 } // namespace extensions 651 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698