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

Unified Diff: chrome/browser/ui/views/toolbar/browser_actions_container.cc

Issue 1670663002: Revert of Views - init less stuff in tabless browsers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual revert Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/toolbar/browser_actions_container.cc
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.cc b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
index b37b11131f2dfc729d3e1c69b450186b642f6d96..71e57f5b4b9b83fc9149a3bcc048381659d0028b 100644
--- a/chrome/browser/ui/views/toolbar/browser_actions_container.cc
+++ b/chrome/browser/ui/views/toolbar/browser_actions_container.cc
@@ -177,6 +177,16 @@ size_t BrowserActionsContainer::VisibleBrowserActionsAfterAnimation() const {
return toolbar_actions_bar_->WidthToIconCount(animation_target_size_);
}
+void BrowserActionsContainer::ExecuteExtensionCommand(
+ const extensions::Extension* extension,
+ const extensions::Command& command) {
+ // Global commands are handled by the ExtensionCommandsGlobalRegistry
+ // instance.
+ DCHECK(!command.global());
+ extension_keybinding_registry_->ExecuteCommand(extension->id(),
+ command.accelerator());
+}
+
bool BrowserActionsContainer::ShownInsideMenu() const {
return in_overflow_mode();
}
@@ -675,6 +685,15 @@ content::WebContents* BrowserActionsContainer::GetCurrentWebContents() {
return browser_->tab_strip_model()->GetActiveWebContents();
}
+extensions::ActiveTabPermissionGranter*
+ BrowserActionsContainer::GetActiveTabPermissionGranter() {
+ content::WebContents* web_contents = GetCurrentWebContents();
+ if (!web_contents)
+ return NULL;
+ return extensions::TabHelper::FromWebContents(web_contents)->
+ active_tab_permission_granter();
+}
+
void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) {
// If the views haven't been initialized yet, wait for the next call to
// paint (one will be triggered by entering highlight mode).
@@ -733,6 +752,15 @@ void BrowserActionsContainer::ViewHierarchyChanged(
return;
if (details.is_add && details.child == this) {
+ if (!in_overflow_mode() && // We only need one keybinding registry.
+ parent()->GetFocusManager()) { // focus manager can be null in tests.
+ extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews(
+ browser_->profile(),
+ parent()->GetFocusManager(),
+ extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS,
+ this));
+ }
+
// Initial toolbar button creation and placement in the widget hierarchy.
// We do this here instead of in the constructor because adding views
// calls Layout on the Toolbar, which needs this object to be constructed
« no previous file with comments | « chrome/browser/ui/views/toolbar/browser_actions_container.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698