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

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

Issue 2746223002: Harmony - update Chrome Cleanup tool prompt dialog. (Closed)
Patch Set: Added test with a file 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 (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/global_error_bubble_view.h" 5 #include "chrome/browser/ui/views/global_error_bubble_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/ui/global_error/global_error.h" 12 #include "chrome/browser/ui/global_error/global_error.h"
13 #include "chrome/browser/ui/global_error/global_error_service.h" 13 #include "chrome/browser/ui/global_error/global_error_service.h"
14 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 14 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
15 #include "chrome/browser/ui/layout_constants.h" 15 #include "chrome/browser/ui/layout_constants.h"
16 #include "chrome/browser/ui/views/elevation_icon_setter.h" 16 #include "chrome/browser/ui/views/elevation_icon_setter.h"
17 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
17 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" 18 #include "chrome/browser/ui/views/toolbar/app_menu_button.h"
18 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 19 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
19 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/base/ui_features.h" 21 #include "ui/base/ui_features.h"
21 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
22 #include "ui/views/bubble/bubble_frame_view.h" 23 #include "ui/views/bubble/bubble_frame_view.h"
23 #include "ui/views/controls/button/blue_button.h" 24 #include "ui/views/controls/button/blue_button.h"
24 #include "ui/views/controls/button/label_button.h" 25 #include "ui/views/controls/button/label_button.h"
25 #include "ui/views/controls/image_view.h" 26 #include "ui/views/controls/image_view.h"
26 #include "ui/views/controls/label.h" 27 #include "ui/views/controls/label.h"
27 #include "ui/views/layout/grid_layout.h" 28 #include "ui/views/layout/grid_layout.h"
28 #include "ui/views/layout/layout_constants.h" 29 #include "ui/views/views_delegate.h"
29 #include "ui/views/window/dialog_client_view.h" 30 #include "ui/views/window/dialog_client_view.h"
30 31
31 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) 32 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER)
32 #include "chrome/browser/ui/views/frame/browser_view.h" 33 #include "chrome/browser/ui/views/frame/browser_view.h"
33 #endif 34 #endif
34 35
35 namespace { 36 namespace {
36 37
37 const int kMaxBubbleViewWidth = 362; 38 const int kMaxBubbleViewWidth = 362;
38 39
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 gfx::ImageSkia GlobalErrorBubbleView::GetWindowIcon() { 83 gfx::ImageSkia GlobalErrorBubbleView::GetWindowIcon() {
83 gfx::Image image; 84 gfx::Image image;
84 if (error_) { 85 if (error_) {
85 image = error_->GetBubbleViewIcon(); 86 image = error_->GetBubbleViewIcon();
86 DCHECK(!image.IsEmpty()); 87 DCHECK(!image.IsEmpty());
87 } 88 }
88 return *image.ToImageSkia(); 89 return *image.ToImageSkia();
89 } 90 }
90 91
91 bool GlobalErrorBubbleView::ShouldShowWindowIcon() const { 92 bool GlobalErrorBubbleView::ShouldShowWindowIcon() const {
92 return true; 93 return LayoutDelegate::Get()->ShouldShowWindowIcon();
93 } 94 }
94 95
95 void GlobalErrorBubbleView::WindowClosing() { 96 void GlobalErrorBubbleView::WindowClosing() {
96 if (error_) 97 if (error_)
97 error_->BubbleViewDidClose(browser_); 98 error_->BubbleViewDidClose(browser_);
98 } 99 }
99 100
100 void GlobalErrorBubbleView::Init() { 101 void GlobalErrorBubbleView::Init() {
101 // |error_| is assumed to be valid, and stay valid, at least until Init() 102 // |error_| is assumed to be valid, and stay valid, at least until Init()
102 // returns. 103 // returns.
(...skipping 16 matching lines...) Expand all
119 120
120 // First row, message labels. 121 // First row, message labels.
121 views::ColumnSet* cs = layout->AddColumnSet(0); 122 views::ColumnSet* cs = layout->AddColumnSet(0);
122 cs->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, 123 cs->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
123 views::GridLayout::FIXED, kMaxBubbleViewWidth, 0); 124 views::GridLayout::FIXED, kMaxBubbleViewWidth, 0);
124 125
125 for (size_t i = 0; i < message_labels.size(); ++i) { 126 for (size_t i = 0; i < message_labels.size(); ++i) {
126 layout->StartRow(1, 0); 127 layout->StartRow(1, 0);
127 layout->AddView(message_labels[i]); 128 layout->AddView(message_labels[i]);
128 if (i < message_labels.size() - 1) 129 if (i < message_labels.size() - 1)
129 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 130 layout->AddPaddingRow(
131 0, views::ViewsDelegate::GetInstance()->GetDistanceMetric(
132 views::DistanceMetric::RELATED_CONTROL_VERTICAL));
130 } 133 }
131 134
132 // These bubbles show at times where activation is sporadic (like at startup, 135 // These bubbles show at times where activation is sporadic (like at startup,
133 // or a new window opening). Make sure the bubble doesn't disappear before the 136 // or a new window opening). Make sure the bubble doesn't disappear before the
134 // user sees it, if the bubble needs to be acknowledged. 137 // user sees it, if the bubble needs to be acknowledged.
135 set_close_on_deactivate(error_->ShouldCloseOnDeactivate()); 138 set_close_on_deactivate(error_->ShouldCloseOnDeactivate());
136 } 139 }
137 140
138 void GlobalErrorBubbleView::UpdateButton(views::LabelButton* button, 141 void GlobalErrorBubbleView::UpdateButton(views::LabelButton* button,
139 ui::DialogButton type) { 142 ui::DialogButton type) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 192 }
190 193
191 bool GlobalErrorBubbleView::Close() { 194 bool GlobalErrorBubbleView::Close() {
192 // Don't fall through to either Cancel() or Accept(). 195 // Don't fall through to either Cancel() or Accept().
193 return true; 196 return true;
194 } 197 }
195 198
196 void GlobalErrorBubbleView::CloseBubbleView() { 199 void GlobalErrorBubbleView::CloseBubbleView() {
197 GetWidget()->Close(); 200 GetWidget()->Close();
198 } 201 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/srt_fetcher_win.cc ('k') | chrome/browser/ui/views/harmony/harmony_layout_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698