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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc

Issue 2753243002: Views/Harmony: Replace layout constants in chrome/browser/ui/views/extensions. (Closed)
Patch Set: Clean up includes. Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/user_metrics_action.h" 10 #include "base/metrics/user_metrics_action.h"
11 #include "chrome/browser/extensions/extension_action_manager.h" 11 #include "chrome/browser/extensions/extension_action_manager.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/chrome_pages.h" 13 #include "chrome/browser/ui/chrome_pages.h"
14 #include "chrome/browser/ui/extensions/extension_installed_bubble.h" 14 #include "chrome/browser/ui/extensions/extension_installed_bubble.h"
15 #include "chrome/browser/ui/singleton_tabs.h" 15 #include "chrome/browser/ui/singleton_tabs.h"
16 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" 16 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h"
17 #include "chrome/browser/ui/views/frame/browser_view.h" 17 #include "chrome/browser/ui/views/frame/browser_view.h"
18 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 19 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
19 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 20 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
20 #include "chrome/browser/ui/views/sync/bubble_sync_promo_view.h" 21 #include "chrome/browser/ui/views/sync/bubble_sync_promo_view.h"
21 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" 22 #include "chrome/browser/ui/views/toolbar/app_menu_button.h"
22 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" 23 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
23 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 24 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
24 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
25 #include "chrome/grit/chromium_strings.h" 26 #include "chrome/grit/chromium_strings.h"
26 #include "chrome/grit/generated_resources.h" 27 #include "chrome/grit/generated_resources.h"
27 #include "components/bubble/bubble_controller.h" 28 #include "components/bubble/bubble_controller.h"
28 #include "components/bubble/bubble_ui.h" 29 #include "components/bubble/bubble_ui.h"
29 #include "content/public/browser/user_metrics.h" 30 #include "content/public/browser/user_metrics.h"
30 #include "extensions/common/extension.h" 31 #include "extensions/common/extension.h"
31 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
32 #include "ui/gfx/image/image_skia_operations.h" 33 #include "ui/gfx/image/image_skia_operations.h"
33 #include "ui/views/bubble/bubble_dialog_delegate.h" 34 #include "ui/views/bubble/bubble_dialog_delegate.h"
34 #include "ui/views/controls/label.h" 35 #include "ui/views/controls/label.h"
35 #include "ui/views/controls/link.h" 36 #include "ui/views/controls/link.h"
36 #include "ui/views/controls/link_listener.h" 37 #include "ui/views/controls/link_listener.h"
37 #include "ui/views/layout/box_layout.h" 38 #include "ui/views/layout/box_layout.h"
38 #include "ui/views/layout/layout_constants.h"
39 39
40 using extensions::Extension; 40 using extensions::Extension;
41 41
42 namespace { 42 namespace {
43 43
44 const int kIconSize = 43; 44 const int kIconSize = 43;
45 45
46 const int kRightColumnWidth = 285; 46 const int kRightColumnWidth = 285;
47 47
48 views::Label* CreateLabel(const base::string16& text) { 48 views::Label* CreateLabel(const base::string16& text) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // ------------------------- 200 // -------------------------
201 // 201 //
202 // Icon and Title are always shown (as well as the close button). 202 // Icon and Title are always shown (as well as the close button).
203 // Info is shown for browser actions, page actions and Omnibox keyword 203 // Info is shown for browser actions, page actions and Omnibox keyword
204 // extensions and might list keyboard shorcut for the former two types. 204 // extensions and might list keyboard shorcut for the former two types.
205 // Extra info is... 205 // Extra info is...
206 // ... for other types, either a description of how to manage the extension 206 // ... for other types, either a description of how to manage the extension
207 // or a link to configure the keybinding shortcut (if one exists). 207 // or a link to configure the keybinding shortcut (if one exists).
208 // Extra info can include a promo for signing into sync. 208 // Extra info can include a promo for signing into sync.
209 209
210 std::unique_ptr<views::BoxLayout> layout( 210 LayoutDelegate* layout_delegate = LayoutDelegate::Get();
211 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 211 std::unique_ptr<views::BoxLayout> layout(new views::BoxLayout(
212 views::kRelatedControlVerticalSpacing)); 212 views::BoxLayout::kVertical, 0, 0,
213 layout_delegate->GetMetric(
214 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)));
213 layout->set_minimum_cross_axis_size(kRightColumnWidth); 215 layout->set_minimum_cross_axis_size(kRightColumnWidth);
214 // Indent by the size of the icon. 216 // Indent by the size of the icon.
215 layout->set_inside_border_insets(gfx::Insets( 217 layout->set_inside_border_insets(gfx::Insets(
216 0, GetIconSize().width() + views::kUnrelatedControlHorizontalSpacing, 0, 218 0,
217 0)); 219 GetIconSize().width() +
220 layout_delegate->GetMetric(
221 LayoutDelegate::Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING),
222 0, 0));
218 layout->set_cross_axis_alignment( 223 layout->set_cross_axis_alignment(
219 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); 224 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START);
220 SetLayoutManager(layout.release()); 225 SetLayoutManager(layout.release());
221 226
222 if (controller_->options() & ExtensionInstalledBubble::HOW_TO_USE) 227 if (controller_->options() & ExtensionInstalledBubble::HOW_TO_USE)
223 AddChildView(CreateLabel(controller_->GetHowToUseDescription())); 228 AddChildView(CreateLabel(controller_->GetHowToUseDescription()));
224 229
225 if (controller_->options() & ExtensionInstalledBubble::SHOW_KEYBINDING) { 230 if (controller_->options() & ExtensionInstalledBubble::SHOW_KEYBINDING) {
226 manage_shortcut_ = new views::Link( 231 manage_shortcut_ = new views::Link(
227 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS)); 232 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 ->browser_actions(); 338 ->browser_actions();
334 return !container->animating(); 339 return !container->animating();
335 } 340 }
336 return true; 341 return true;
337 } 342 }
338 343
339 // Implemented here to create the platform specific instance of the BubbleUi. 344 // Implemented here to create the platform specific instance of the BubbleUi.
340 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { 345 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() {
341 return base::WrapUnique(new ExtensionInstalledBubbleUi(this)); 346 return base::WrapUnique(new ExtensionInstalledBubbleUi(this));
342 } 347 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698