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

Side by Side Diff: ui/views/bubble/bubble_dialog_delegate.cc

Issue 1866403005: Fix rtl shelf overflow bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small review fixes (and merge) Created 4 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 | « ui/views/bubble/bubble_dialog_delegate.h ('k') | ui/views/window/non_client_view.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/views/bubble/bubble_dialog_delegate.h" 5 #include "ui/views/bubble/bubble_dialog_delegate.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/color_utils.h" 10 #include "ui/gfx/color_utils.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 return this; 87 return this;
88 } 88 }
89 89
90 bool BubbleDialogDelegateView::ShouldShowCloseButton() const { 90 bool BubbleDialogDelegateView::ShouldShowCloseButton() const {
91 return false; 91 return false;
92 } 92 }
93 93
94 ClientView* BubbleDialogDelegateView::CreateClientView(Widget* widget) { 94 ClientView* BubbleDialogDelegateView::CreateClientView(Widget* widget) {
95 DialogClientView* client = new DialogClientView(widget, GetContentsView()); 95 DialogClientView* client = new DialogClientView(widget, GetContentsView());
96 client->set_button_row_insets(gfx::Insets()); 96 client->set_button_row_insets(gfx::Insets());
97 widget->non_client_view()->set_mirror_client_in_rtl(mirror_arrow_in_rtl_);
97 return client; 98 return client;
98 } 99 }
99 100
100 NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView( 101 NonClientFrameView* BubbleDialogDelegateView::CreateNonClientFrameView(
101 Widget* widget) { 102 Widget* widget) {
102 BubbleFrameView* frame = new BubbleFrameView( 103 BubbleFrameView* frame = new BubbleFrameView(
103 gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin), 104 gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, kPanelHorizMargin),
104 margins()); 105 margins());
105 // Note: In CreateBubble, the call to SizeToContents() will cause 106 // Note: In CreateBubble, the call to SizeToContents() will cause
106 // the relayout that this call requires. 107 // the relayout that this call requires.
107 frame->SetTitleFontList(GetTitleFontList()); 108 frame->SetTitleFontList(GetTitleFontList());
108 frame->SetFootnoteView(CreateFootnoteView()); 109 frame->SetFootnoteView(CreateFootnoteView());
109 110
110 BubbleBorder::Arrow adjusted_arrow = arrow(); 111 BubbleBorder::Arrow adjusted_arrow = arrow();
111 if (base::i18n::IsRTL()) 112 if (base::i18n::IsRTL() && mirror_arrow_in_rtl_)
112 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); 113 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow);
113 frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>( 114 frame->SetBubbleBorder(std::unique_ptr<BubbleBorder>(
114 new BubbleBorder(adjusted_arrow, shadow(), color()))); 115 new BubbleBorder(adjusted_arrow, shadow(), color())));
115 return frame; 116 return frame;
116 } 117 }
117 118
118 const char* BubbleDialogDelegateView::GetClassName() const { 119 const char* BubbleDialogDelegateView::GetClassName() const {
119 return kViewClassName; 120 return kViewClassName;
120 } 121 }
121 122
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 195
195 BubbleDialogDelegateView::BubbleDialogDelegateView() 196 BubbleDialogDelegateView::BubbleDialogDelegateView()
196 : BubbleDialogDelegateView(nullptr, BubbleBorder::TOP_LEFT) {} 197 : BubbleDialogDelegateView(nullptr, BubbleBorder::TOP_LEFT) {}
197 198
198 BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view, 199 BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view,
199 BubbleBorder::Arrow arrow) 200 BubbleBorder::Arrow arrow)
200 : close_on_deactivate_(true), 201 : close_on_deactivate_(true),
201 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), 202 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()),
202 anchor_widget_(NULL), 203 anchor_widget_(NULL),
203 arrow_(arrow), 204 arrow_(arrow),
205 mirror_arrow_in_rtl_(true),
204 shadow_(BubbleBorder::SMALL_SHADOW), 206 shadow_(BubbleBorder::SMALL_SHADOW),
205 color_explicitly_set_(false), 207 color_explicitly_set_(false),
206 margins_(kPanelVertMargin, 208 margins_(kPanelVertMargin,
207 kPanelHorizMargin, 209 kPanelHorizMargin,
208 kPanelVertMargin, 210 kPanelVertMargin,
209 kPanelHorizMargin), 211 kPanelHorizMargin),
210 accept_events_(true), 212 accept_events_(true),
211 border_accepts_events_(true), 213 border_accepts_events_(true),
212 adjust_if_offscreen_(true), 214 adjust_if_offscreen_(true),
213 parent_window_(NULL) { 215 parent_window_(NULL) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // http://crbug.com/474622 for details. 308 // http://crbug.com/474622 for details.
307 if (widget == GetWidget() && visible) { 309 if (widget == GetWidget() && visible) {
308 ui::AXViewState state; 310 ui::AXViewState state;
309 GetAccessibleState(&state); 311 GetAccessibleState(&state);
310 if (state.role == ui::AX_ROLE_ALERT_DIALOG) 312 if (state.role == ui::AX_ROLE_ALERT_DIALOG)
311 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 313 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
312 } 314 }
313 } 315 }
314 316
315 } // namespace views 317 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_dialog_delegate.h ('k') | ui/views/window/non_client_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698