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

Side by Side Diff: chrome/browser/ui/views/first_run_bubble.cc

Issue 2837153003: Views/Harmony Remove references to ui/views/layout/layout_constants.h (Closed)
Patch Set: Fix build redness Created 3 years, 8 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 (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/first_run_bubble.h" 5 #include "chrome/browser/ui/views/first_run_bubble.h"
6 6
7 #include "chrome/browser/first_run/first_run.h" 7 #include "chrome/browser/first_run/first_run.h"
8 #include "chrome/browser/search_engines/template_url_service_factory.h" 8 #include "chrome/browser/search_engines/template_url_service_factory.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_dialogs.h" 10 #include "chrome/browser/ui/browser_dialogs.h"
11 #include "chrome/browser/ui/chrome_pages.h" 11 #include "chrome/browser/ui/chrome_pages.h"
12 #include "chrome/browser/ui/layout_constants.h" 12 #include "chrome/browser/ui/layout_constants.h"
13 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
13 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
14 #include "components/search_engines/util.h" 15 #include "components/search_engines/util.h"
15 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/views/controls/label.h" 18 #include "ui/views/controls/label.h"
18 #include "ui/views/controls/link.h" 19 #include "ui/views/controls/link.h"
19 #include "ui/views/event_monitor.h" 20 #include "ui/views/event_monitor.h"
20 #include "ui/views/layout/grid_layout.h" 21 #include "ui/views/layout/grid_layout.h"
21 #include "ui/views/layout/layout_constants.h"
22 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
23 23
24 namespace { 24 namespace {
25 const int kTopInset = 1; 25 const int kTopInset = 1;
26 const int kLeftInset = 2; 26 const int kLeftInset = 2;
27 const int kBottomInset = 7; 27 const int kBottomInset = 7;
28 const int kRightInset = 2; 28 const int kRightInset = 2;
29 } // namespace 29 } // namespace
30 30
31 // static 31 // static
(...skipping 26 matching lines...) Expand all
58 new views::Link(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_CHANGE)); 58 new views::Link(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_CHANGE));
59 change->SetFontList(original_font_list); 59 change->SetFontList(original_font_list);
60 change->set_listener(this); 60 change->set_listener(this);
61 61
62 views::Label* subtext = new views::Label( 62 views::Label* subtext = new views::Label(
63 l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT), {original_font_list}); 63 l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT), {original_font_list});
64 64
65 views::GridLayout* layout = views::GridLayout::CreatePanel(this); 65 views::GridLayout* layout = views::GridLayout::CreatePanel(this);
66 layout->SetInsets(kTopInset, kLeftInset, kBottomInset, kRightInset); 66 layout->SetInsets(kTopInset, kLeftInset, kBottomInset, kRightInset);
67 67
68 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
69
68 views::ColumnSet* columns = layout->AddColumnSet(0); 70 views::ColumnSet* columns = layout->AddColumnSet(0);
69 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0, 71 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0,
70 views::GridLayout::USE_PREF, 0, 0); 72 views::GridLayout::USE_PREF, 0, 0);
71 columns->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); 73 columns->AddPaddingColumn(0, provider->GetDistanceMetric(
74 views::DISTANCE_RELATED_CONTROL_HORIZONTAL));
72 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0, 75 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0,
73 views::GridLayout::USE_PREF, 0, 0); 76 views::GridLayout::USE_PREF, 0, 0);
74 columns->AddPaddingColumn(1, 0); 77 columns->AddPaddingColumn(1, 0);
75 78
76 layout->StartRow(0, 0); 79 layout->StartRow(0, 0);
77 layout->AddView(title); 80 layout->AddView(title);
78 layout->AddView(change); 81 layout->AddView(change);
79 layout->StartRowWithPadding(0, 0, 0, 82 layout->StartRowWithPadding(
80 views::kRelatedControlSmallVerticalSpacing); 83 0, 0, 0,
84 provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL_SMALL));
81 layout->AddView(subtext, columns->num_columns(), 1); 85 layout->AddView(subtext, columns->num_columns(), 1);
82 } 86 }
83 87
84 FirstRunBubble::FirstRunBubble(Browser* browser, views::View* anchor_view) 88 FirstRunBubble::FirstRunBubble(Browser* browser, views::View* anchor_view)
85 : views::BubbleDialogDelegateView(anchor_view, 89 : views::BubbleDialogDelegateView(anchor_view,
86 views::BubbleBorder::TOP_LEFT), 90 views::BubbleBorder::TOP_LEFT),
87 browser_(browser), 91 browser_(browser),
88 bubble_closer_(this, anchor_view) { 92 bubble_closer_(this, anchor_view) {
89 // Compensate for built-in vertical padding in the anchor view's image. 93 // Compensate for built-in vertical padding in the anchor view's image.
90 set_anchor_view_insets(gfx::Insets( 94 set_anchor_view_insets(gfx::Insets(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 141
138 void FirstRunBubble::FirstRunBubbleCloser::CloseBubble() { 142 void FirstRunBubble::FirstRunBubbleCloser::CloseBubble() {
139 if (!event_monitor_) 143 if (!event_monitor_)
140 return; 144 return;
141 145
142 event_monitor_.reset(); 146 event_monitor_.reset();
143 DCHECK(bubble_); 147 DCHECK(bubble_);
144 bubble_->GetWidget()->Close(); 148 bubble_->GetWidget()->Close();
145 bubble_ = nullptr; 149 bubble_ = nullptr;
146 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698