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

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

Issue 2891013002: Views/Harmony Remove references to ui/views/layout/layout_constants.h (Closed)
Patch Set: Fix build error Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/create_application_shortcut_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/collected_cookies_views.h" 5 #include "chrome/browser/ui/views/collected_cookies_views.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" 8 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"
10 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 10 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
(...skipping 29 matching lines...) Expand all
40 #include "ui/gfx/color_utils.h" 40 #include "ui/gfx/color_utils.h"
41 #include "ui/views/border.h" 41 #include "ui/views/border.h"
42 #include "ui/views/controls/button/md_text_button.h" 42 #include "ui/views/controls/button/md_text_button.h"
43 #include "ui/views/controls/image_view.h" 43 #include "ui/views/controls/image_view.h"
44 #include "ui/views/controls/label.h" 44 #include "ui/views/controls/label.h"
45 #include "ui/views/controls/scroll_view.h" 45 #include "ui/views/controls/scroll_view.h"
46 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" 46 #include "ui/views/controls/tabbed_pane/tabbed_pane.h"
47 #include "ui/views/controls/tree/tree_view.h" 47 #include "ui/views/controls/tree/tree_view.h"
48 #include "ui/views/layout/box_layout.h" 48 #include "ui/views/layout/box_layout.h"
49 #include "ui/views/layout/grid_layout.h" 49 #include "ui/views/layout/grid_layout.h"
50 #include "ui/views/layout/layout_constants.h"
51 #include "ui/views/widget/widget.h" 50 #include "ui/views/widget/widget.h"
52 51
53 namespace { 52 namespace {
54 53
55 // Spacing between the infobar frame and its contents. 54 // Spacing between the infobar frame and its contents.
56 const int kInfobarVerticalPadding = 3; 55 const int kInfobarVerticalPadding = 3;
57 const int kInfobarHorizontalPadding = 8; 56 const int kInfobarHorizontalPadding = 8;
58 57
59 // Width of the infobar frame. 58 // Width of the infobar frame.
60 const int kInfobarBorderSize = 1; 59 const int kInfobarBorderSize = 1;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 141 }
143 142
144 private: 143 private:
145 // Initialize contents and layout. 144 // Initialize contents and layout.
146 void Init() { 145 void Init() {
147 AddChildView(content_); 146 AddChildView(content_);
148 content_->SetLayoutManager( 147 content_->SetLayoutManager(
149 new views::BoxLayout(views::BoxLayout::kHorizontal, 148 new views::BoxLayout(views::BoxLayout::kHorizontal,
150 kInfobarHorizontalPadding, 149 kInfobarHorizontalPadding,
151 kInfobarVerticalPadding, 150 kInfobarVerticalPadding,
152 views::kRelatedControlSmallHorizontalSpacing)); 151 ChromeLayoutProvider::Get()->GetDistanceMetric(
152 DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL)));
153 content_->AddChildView(info_image_); 153 content_->AddChildView(info_image_);
154 content_->AddChildView(label_); 154 content_->AddChildView(label_);
155 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16()); 155 UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16());
156 } 156 }
157 157
158 // views::View overrides. 158 // views::View overrides.
159 gfx::Size GetPreferredSize() const override { 159 gfx::Size GetPreferredSize() const override {
160 // Always return the preferred size, even if not currently visible. This 160 // Always return the preferred size, even if not currently visible. This
161 // ensures that the layout manager always reserves space within the view 161 // ensures that the layout manager always reserves space within the view
162 // so it can be made visible when necessary. Otherwise, changing the 162 // so it can be made visible when necessary. Otherwise, changing the
163 // visibility of this view would require the entire dialog to be resized, 163 // visibility of this view would require the entire dialog to be resized,
164 // which is undesirable from both a UX and technical perspective. 164 // which is undesirable from both a UX and technical perspective.
165 165
166 // Add space around the banner. 166 // Add space around the banner.
167 gfx::Size size(content_->GetPreferredSize()); 167 gfx::Size size(content_->GetPreferredSize());
168 size.Enlarge(0, 2 * views::kRelatedControlVerticalSpacing); 168 size.Enlarge(0, 2 * ChromeLayoutProvider::Get()->GetDistanceMetric(
169 views::DISTANCE_RELATED_CONTROL_VERTICAL));
169 return size; 170 return size;
170 } 171 }
171 172
172 void Layout() override { 173 void Layout() override {
174 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
175 const int vertical_spacing =
176 provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL);
173 content_->SetBounds( 177 content_->SetBounds(
174 0, views::kRelatedControlVerticalSpacing, 178 0, vertical_spacing, width(), height() - vertical_spacing);
175 width(), height() - views::kRelatedControlVerticalSpacing);
176 } 179 }
177 180
178 void ViewHierarchyChanged( 181 void ViewHierarchyChanged(
179 const ViewHierarchyChangedDetails& details) override { 182 const ViewHierarchyChangedDetails& details) override {
180 if (details.is_add && details.child == this) 183 if (details.is_add && details.child == this)
181 Init(); 184 Init();
182 } 185 }
183 186
184 // Holds the info icon image and text label and renders the border. 187 // Holds the info icon image and text label and renders the border.
185 views::View* content_; 188 views::View* content_;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 /////////////////////////////////////////////////////////////////////////////// 549 ///////////////////////////////////////////////////////////////////////////////
547 // CollectedCookiesViews, content::NotificationObserver implementation: 550 // CollectedCookiesViews, content::NotificationObserver implementation:
548 551
549 void CollectedCookiesViews::Observe( 552 void CollectedCookiesViews::Observe(
550 int type, 553 int type,
551 const content::NotificationSource& source, 554 const content::NotificationSource& source,
552 const content::NotificationDetails& details) { 555 const content::NotificationDetails& details) {
553 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type); 556 DCHECK_EQ(chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, type);
554 GetWidget()->Close(); 557 GetWidget()->Close();
555 } 558 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/create_application_shortcut_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698