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

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

Issue 10446034: Rename ActionBoxController -> LocationBarController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: grammar Created 8 years, 6 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
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/script_badge_controller.h" 5 #include "chrome/browser/extensions/script_badge_controller.h"
6 6
7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 it != service->extensions()->end(); ++it) { 42 it != service->extensions()->end(); ++it) {
43 const Extension* extension = *it; 43 const Extension* extension = *it;
44 if (extension->HasContentScriptAtURL(current_url) || 44 if (extension->HasContentScriptAtURL(current_url) ||
45 extensions_executing_scripts_.count(extension->id())) { 45 extensions_executing_scripts_.count(extension->id())) {
46 current_actions->push_back(GetScriptBadge(extension)); 46 current_actions->push_back(GetScriptBadge(extension));
47 } 47 }
48 } 48 }
49 return current_actions.Pass(); 49 return current_actions.Pass();
50 } 50 }
51 51
52 ActionBoxController::Action ScriptBadgeController::OnClicked( 52 LocationBarController::Action ScriptBadgeController::OnClicked(
53 const std::string& extension_id, int mouse_button) { 53 const std::string& extension_id, int mouse_button) {
54 ExtensionService* service = GetExtensionService(); 54 ExtensionService* service = GetExtensionService();
55 if (!service) 55 if (!service)
56 return ACTION_NONE; 56 return ACTION_NONE;
57 57
58 const Extension* extension = service->extensions()->GetByID(extension_id); 58 const Extension* extension = service->extensions()->GetByID(extension_id);
59 CHECK(extension); 59 CHECK(extension);
60 60
61 switch (mouse_button) { 61 switch (mouse_button) {
62 case 3: // right 62 case 3: // right
(...skipping 16 matching lines...) Expand all
79 script_type, 79 script_type,
80 code, 80 code,
81 frame_scope, 81 frame_scope,
82 run_at, 82 run_at,
83 world_type, 83 world_type,
84 callback); 84 callback);
85 85
86 // This tab should now show that the extension executing a script. 86 // This tab should now show that the extension executing a script.
87 extensions_executing_scripts_.insert(extension_id); 87 extensions_executing_scripts_.insert(extension_id);
88 content::NotificationService::current()->Notify( 88 content::NotificationService::current()->Notify(
89 // TODO(aa): Update this name?
not at google - send to devlin 2012/05/25 22:29:50 yes, we should.
Aaron Boodman 2012/05/26 07:42:18 Done.
89 chrome::NOTIFICATION_EXTENSION_ACTION_BOX_UPDATED, 90 chrome::NOTIFICATION_EXTENSION_ACTION_BOX_UPDATED,
90 content::Source<Profile>(tab_contents_->profile()), 91 content::Source<Profile>(tab_contents_->profile()),
91 content::Details<TabContentsWrapper>(tab_contents_)); 92 content::Details<TabContentsWrapper>(tab_contents_));
92 } 93 }
93 94
94 void ScriptBadgeController::DidNavigateMainFrame( 95 void ScriptBadgeController::DidNavigateMainFrame(
95 const content::LoadCommittedDetails& details, 96 const content::LoadCommittedDetails& details,
96 const content::FrameNavigateParams& params) { 97 const content::FrameNavigateParams& params) {
97 extensions_executing_scripts_.clear(); 98 extensions_executing_scripts_.clear();
98 } 99 }
(...skipping 28 matching lines...) Expand all
127 128
128 script_badges_[extension->id()] = badge; 129 script_badges_[extension->id()] = badge;
129 return badge.get(); 130 return badge.get();
130 } 131 }
131 132
132 ExtensionService* ScriptBadgeController::GetExtensionService() { 133 ExtensionService* ScriptBadgeController::GetExtensionService() {
133 return ExtensionSystem::Get(tab_contents_->profile())->extension_service(); 134 return ExtensionSystem::Get(tab_contents_->profile())->extension_service();
134 } 135 }
135 136
136 } // namespace extensions 137 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698