OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/toolbar/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 if (visible) { | 277 if (visible) { |
278 // Safe to call multiple times; the bubble will only appear once. | 278 // Safe to call multiple times; the bubble will only appear once. |
279 extension_message_bubble_factory_->MaybeShow(app_menu_); | 279 extension_message_bubble_factory_->MaybeShow(app_menu_); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 void ToolbarView::OnWidgetActivationChanged(views::Widget* widget, | 283 void ToolbarView::OnWidgetActivationChanged(views::Widget* widget, |
284 bool active) { | 284 bool active) { |
285 extensions::ExtensionCommandsGlobalRegistry* registry = | 285 extensions::ExtensionCommandsGlobalRegistry* registry = |
286 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()); | 286 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()); |
287 if (registry) { | 287 if (active) { |
288 if (active) { | 288 registry->set_registry_for_active_window( |
289 registry->set_registry_for_active_window( | 289 browser_actions_->extension_keybinding_registry()); |
290 browser_actions_->extension_keybinding_registry()); | 290 } else if (registry->registry_for_active_window() == |
291 } else if (registry->registry_for_active_window() == | 291 browser_actions_->extension_keybinding_registry()) { |
292 browser_actions_->extension_keybinding_registry()) { | 292 registry->set_registry_for_active_window(nullptr); |
293 registry->set_registry_for_active_window(NULL); | |
294 } | |
295 } | 293 } |
296 } | 294 } |
297 | 295 |
298 void ToolbarView::Update(WebContents* tab) { | 296 void ToolbarView::Update(WebContents* tab) { |
299 if (location_bar_) | 297 if (location_bar_) |
300 location_bar_->Update(tab); | 298 location_bar_->Update(tab); |
301 if (browser_actions_) | 299 if (browser_actions_) |
302 browser_actions_->RefreshToolbarActionViews(); | 300 browser_actions_->RefreshToolbarActionViews(); |
303 if (reload_) | 301 if (reload_) |
304 reload_->set_menu_enabled(chrome::IsDebuggerAttachedToCurrentTab(browser_)); | 302 reload_->set_menu_enabled(chrome::IsDebuggerAttachedToCurrentTab(browser_)); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 | 787 |
790 void ToolbarView::OnShowHomeButtonChanged() { | 788 void ToolbarView::OnShowHomeButtonChanged() { |
791 Layout(); | 789 Layout(); |
792 SchedulePaint(); | 790 SchedulePaint(); |
793 } | 791 } |
794 | 792 |
795 int ToolbarView::content_shadow_height() const { | 793 int ToolbarView::content_shadow_height() const { |
796 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? | 794 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? |
797 kContentShadowHeightAsh : kContentShadowHeight; | 795 kContentShadowHeightAsh : kContentShadowHeight; |
798 } | 796 } |
OLD | NEW |