| 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/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 LoadImages(); | 728 LoadImages(); |
| 729 } | 729 } |
| 730 | 730 |
| 731 void BrowserActionsContainer::ViewHierarchyChanged( | 731 void BrowserActionsContainer::ViewHierarchyChanged( |
| 732 const ViewHierarchyChangedDetails& details) { | 732 const ViewHierarchyChangedDetails& details) { |
| 733 if (!toolbar_actions_bar_->enabled()) | 733 if (!toolbar_actions_bar_->enabled()) |
| 734 return; | 734 return; |
| 735 | 735 |
| 736 if (details.is_add && details.child == this) { | 736 if (details.is_add && details.child == this) { |
| 737 if (!in_overflow_mode() && // We only need one keybinding registry. | 737 if (!in_overflow_mode() && // We only need one keybinding registry. |
| 738 parent()->GetFocusManager()) { // focus manager can be null in tests. | 738 GetFocusManager()) { // focus manager can be null in tests. |
| 739 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 739 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
| 740 browser_->profile(), | 740 browser_->profile(), |
| 741 parent()->GetFocusManager(), | 741 GetWidget(), |
| 742 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, | 742 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, |
| 743 this)); | 743 this)); |
| 744 } | 744 } |
| 745 | 745 |
| 746 // Initial toolbar button creation and placement in the widget hierarchy. | 746 // Initial toolbar button creation and placement in the widget hierarchy. |
| 747 // We do this here instead of in the constructor because adding views | 747 // We do this here instead of in the constructor because adding views |
| 748 // calls Layout on the Toolbar, which needs this object to be constructed | 748 // calls Layout on the Toolbar, which needs this object to be constructed |
| 749 // before its Layout function is called. | 749 // before its Layout function is called. |
| 750 toolbar_actions_bar_->CreateActions(); | 750 toolbar_actions_bar_->CreateActions(); |
| 751 | 751 |
| 752 added_to_view_ = true; | 752 added_to_view_ = true; |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 | 755 |
| 756 void BrowserActionsContainer::LoadImages() { | 756 void BrowserActionsContainer::LoadImages() { |
| 757 if (in_overflow_mode()) | 757 if (in_overflow_mode()) |
| 758 return; // Overflow mode has neither a chevron nor highlighting. | 758 return; // Overflow mode has neither a chevron nor highlighting. |
| 759 | 759 |
| 760 ui::ThemeProvider* tp = GetThemeProvider(); | 760 ui::ThemeProvider* tp = GetThemeProvider(); |
| 761 if (tp && chevron_) { | 761 if (tp && chevron_) { |
| 762 chevron_->SetImage(views::Button::STATE_NORMAL, | 762 chevron_->SetImage(views::Button::STATE_NORMAL, |
| 763 *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW)); | 763 *tp->GetImageSkiaNamed(IDR_BROWSER_ACTIONS_OVERFLOW)); |
| 764 } | 764 } |
| 765 | 765 |
| 766 const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); | 766 const int kImages[] = IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT); |
| 767 highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); | 767 highlight_painter_.reset(views::Painter::CreateImageGridPainter(kImages)); |
| 768 } | 768 } |
| OLD | NEW |