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/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 // Horizontal spacing between most items in the container, as well as after the | 42 // Horizontal spacing between most items in the container, as well as after the |
43 // last item or chevron (if visible). | 43 // last item or chevron (if visible). |
44 const int kItemSpacing = ToolbarView::kStandardSpacing; | 44 const int kItemSpacing = ToolbarView::kStandardSpacing; |
45 | 45 |
46 // Horizontal spacing before the chevron (if visible). | 46 // Horizontal spacing before the chevron (if visible). |
47 const int kChevronSpacing = kItemSpacing - 2; | 47 const int kChevronSpacing = kItemSpacing - 2; |
48 | 48 |
49 void RegisterUserPrefs(PrefService* prefs) { | 49 void RegisterUserPrefs(PrefServiceSyncable* prefs) { |
50 prefs->RegisterIntegerPref(prefs::kBrowserActionContainerWidth, | 50 prefs->RegisterIntegerPref(prefs::kBrowserActionContainerWidth, |
51 0, | 51 0, |
52 PrefService::UNSYNCABLE_PREF); | 52 PrefServiceSyncable::UNSYNCABLE_PREF); |
53 } | 53 } |
54 | 54 |
55 } // namespace | 55 } // namespace |
56 | 56 |
57 // static | 57 // static |
58 bool BrowserActionsContainer::disable_animations_during_testing_ = false; | 58 bool BrowserActionsContainer::disable_animations_during_testing_ = false; |
59 | 59 |
60 //////////////////////////////////////////////////////////////////////////////// | 60 //////////////////////////////////////////////////////////////////////////////// |
61 // BrowserActionsContainer | 61 // BrowserActionsContainer |
62 | 62 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 popup_->GetWidget()->RemoveObserver(this); | 113 popup_->GetWidget()->RemoveObserver(this); |
114 HidePopup(); | 114 HidePopup(); |
115 DeleteBrowserActionViews(); | 115 DeleteBrowserActionViews(); |
116 } | 116 } |
117 | 117 |
118 void BrowserActionsContainer::Init() { | 118 void BrowserActionsContainer::Init() { |
119 LoadImages(); | 119 LoadImages(); |
120 | 120 |
121 if (!profile_->GetPrefs()->FindPreference( | 121 if (!profile_->GetPrefs()->FindPreference( |
122 prefs::kBrowserActionContainerWidth)) | 122 prefs::kBrowserActionContainerWidth)) |
123 RegisterUserPrefs(profile_->GetPrefs()); | 123 RegisterUserPrefs(profile_->GetPrefs()); |
Mattias Nissler (ping if slow)
2012/12/20 13:41:52
Random note: This should be called via browser_pre
Jói
2012/12/20 16:30:31
Added TODO.
| |
124 | 124 |
125 // We wait to set the container width until now so that the chevron images | 125 // We wait to set the container width until now so that the chevron images |
126 // will be loaded. The width calculation needs to know the chevron size. | 126 // will be loaded. The width calculation needs to know the chevron size. |
127 if (model_ && | 127 if (model_ && |
128 !profile_->GetPrefs()->HasPrefPath(prefs::kExtensionToolbarSize)) { | 128 !profile_->GetPrefs()->HasPrefPath(prefs::kExtensionToolbarSize)) { |
129 // Migration code to the new VisibleIconCount pref. | 129 // Migration code to the new VisibleIconCount pref. |
130 // TODO(mpcomplete): remove this after users are upgraded to 5.0. | 130 // TODO(mpcomplete): remove this after users are upgraded to 5.0. |
131 int predefined_width = | 131 int predefined_width = |
132 profile_->GetPrefs()->GetInteger(prefs::kBrowserActionContainerWidth); | 132 profile_->GetPrefs()->GetInteger(prefs::kBrowserActionContainerWidth); |
133 if (predefined_width != 0) | 133 if (predefined_width != 0) |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; | 847 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; |
848 popup_ = ExtensionPopup::ShowPopup(popup_url, | 848 popup_ = ExtensionPopup::ShowPopup(popup_url, |
849 browser_, | 849 browser_, |
850 reference_view, | 850 reference_view, |
851 arrow_location, | 851 arrow_location, |
852 show_action); | 852 show_action); |
853 popup_->GetWidget()->AddObserver(this); | 853 popup_->GetWidget()->AddObserver(this); |
854 popup_button_ = button; | 854 popup_button_ = button; |
855 popup_button_->SetButtonPushed(); | 855 popup_button_->SetButtonPushed(); |
856 } | 856 } |
OLD | NEW |