OLD | NEW |
---|---|
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/ui/views/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/browser_actions_container.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "ui/base/dragdrop/drag_utils.h" | 28 #include "ui/base/dragdrop/drag_utils.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
31 #include "ui/base/theme_provider.h" | 31 #include "ui/base/theme_provider.h" |
32 #include "ui/gfx/animation/slide_animation.h" | 32 #include "ui/gfx/animation/slide_animation.h" |
33 #include "ui/gfx/canvas.h" | 33 #include "ui/gfx/canvas.h" |
34 #include "ui/views/controls/resize_area.h" | 34 #include "ui/views/controls/resize_area.h" |
35 #include "ui/views/metrics.h" | 35 #include "ui/views/metrics.h" |
36 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
37 | 37 |
38 // TODO(finnur): Remove when I've found a more permanent location for the global | |
39 // shortcut listener. | |
40 #include "chrome/browser/ui/views/extensions/extension_commands_global_registry_ views.h" | |
41 | |
38 using extensions::Extension; | 42 using extensions::Extension; |
39 | 43 |
40 namespace { | 44 namespace { |
41 | 45 |
42 // Horizontal spacing between most items in the container, as well as after the | 46 // Horizontal spacing between most items in the container, as well as after the |
43 // last item or chevron (if visible). | 47 // last item or chevron (if visible). |
44 const int kItemSpacing = ToolbarView::kStandardSpacing; | 48 const int kItemSpacing = ToolbarView::kStandardSpacing; |
45 | 49 |
46 // Horizontal spacing before the chevron (if visible). | 50 // Horizontal spacing before the chevron (if visible). |
47 const int kChevronSpacing = kItemSpacing - 2; | 51 const int kChevronSpacing = kItemSpacing - 2; |
(...skipping 25 matching lines...) Expand all Loading... | |
73 show_menu_task_factory_(this) { | 77 show_menu_task_factory_(this) { |
74 set_id(VIEW_ID_BROWSER_ACTION_TOOLBAR); | 78 set_id(VIEW_ID_BROWSER_ACTION_TOOLBAR); |
75 | 79 |
76 ExtensionService* service = | 80 ExtensionService* service = |
77 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 81 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
78 if (service) { | 82 if (service) { |
79 model_ = service->toolbar_model(); | 83 model_ = service->toolbar_model(); |
80 model_->AddObserver(this); | 84 model_->AddObserver(this); |
81 } | 85 } |
82 | 86 |
87 // TODO(finnur): find a better place for this. | |
zhchbin
2013/09/26 14:45:00
How about make the ExtensionCommandsGlobalRegistry
Finnur
2013/09/26 15:01:00
Haven't revisited this TODO, but now is a good tim
| |
88 extensions::ExtensionCommandsGlobalRegistryViews::GetFactoryInstance()-> | |
89 GetForProfile(browser->profile()); | |
90 | |
83 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 91 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
84 browser->profile(), | 92 browser->profile(), |
85 owner_view->GetFocusManager(), | 93 owner_view->GetFocusManager(), |
86 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, | 94 extensions::ExtensionKeybindingRegistry::ALL_EXTENSIONS, |
87 this)), | 95 this)); |
88 | 96 |
89 resize_animation_.reset(new gfx::SlideAnimation(this)); | 97 resize_animation_.reset(new gfx::SlideAnimation(this)); |
90 resize_area_ = new views::ResizeArea(this); | 98 resize_area_ = new views::ResizeArea(this); |
91 AddChildView(resize_area_); | 99 AddChildView(resize_area_); |
92 | 100 |
93 chevron_ = new views::MenuButton(NULL, string16(), this, false); | 101 chevron_ = new views::MenuButton(NULL, string16(), this, false); |
94 chevron_->set_border(NULL); | 102 chevron_->set_border(NULL); |
95 chevron_->EnableCanvasFlippingForRTLUI(true); | 103 chevron_->EnableCanvasFlippingForRTLUI(true); |
96 chevron_->SetAccessibleName( | 104 chevron_->SetAccessibleName( |
97 l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_CHEVRON)); | 105 l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_CHEVRON)); |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
840 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; | 848 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; |
841 popup_ = ExtensionPopup::ShowPopup(popup_url, | 849 popup_ = ExtensionPopup::ShowPopup(popup_url, |
842 browser_, | 850 browser_, |
843 reference_view, | 851 reference_view, |
844 arrow, | 852 arrow, |
845 show_action); | 853 show_action); |
846 popup_->GetWidget()->AddObserver(this); | 854 popup_->GetWidget()->AddObserver(this); |
847 popup_button_ = button; | 855 popup_button_ = button; |
848 popup_button_->SetButtonPushed(); | 856 popup_button_->SetButtonPushed(); |
849 } | 857 } |
OLD | NEW |