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

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

Issue 326963002: [Views] Add a capability to the bubble delegate to be able to show the title in BaseFont. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 | Annotate | Revision Log
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 "ui/views/bubble/bubble_delegate.h" 5 #include "ui/views/bubble/bubble_delegate.h"
6 6
7 #include "ui/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/base/resource/resource_bundle.h"
8 #include "ui/gfx/color_utils.h" 9 #include "ui/gfx/color_utils.h"
9 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
10 #include "ui/native_theme/native_theme.h" 11 #include "ui/native_theme/native_theme.h"
11 #include "ui/views/bubble/bubble_frame_view.h" 12 #include "ui/views/bubble/bubble_frame_view.h"
12 #include "ui/views/focus/view_storage.h" 13 #include "ui/views/focus/view_storage.h"
13 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
14 #include "ui/views/widget/widget_observer.h" 15 #include "ui/views/widget/widget_observer.h"
15 16
16 #if defined(OS_WIN) 17 #if defined(OS_WIN)
17 #include "ui/base/win/shell.h" 18 #include "ui/base/win/shell.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return false; 125 return false;
125 } 126 }
126 127
127 View* BubbleDelegateView::GetContentsView() { 128 View* BubbleDelegateView::GetContentsView() {
128 return this; 129 return this;
129 } 130 }
130 131
131 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( 132 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView(
132 Widget* widget) { 133 Widget* widget) {
133 BubbleFrameView* frame = new BubbleFrameView(margins()); 134 BubbleFrameView* frame = new BubbleFrameView(margins());
135 frame->SetTitleFontList(GetTitleFontList());
134 BubbleBorder::Arrow adjusted_arrow = arrow(); 136 BubbleBorder::Arrow adjusted_arrow = arrow();
135 if (base::i18n::IsRTL()) 137 if (base::i18n::IsRTL())
136 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); 138 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow);
137 frame->SetBubbleBorder(scoped_ptr<BubbleBorder>( 139 frame->SetBubbleBorder(scoped_ptr<BubbleBorder>(
138 new BubbleBorder(adjusted_arrow, shadow(), color()))); 140 new BubbleBorder(adjusted_arrow, shadow(), color())));
139 return frame; 141 return frame;
140 } 142 }
141 143
142 void BubbleDelegateView::GetAccessibleState(ui::AXViewState* state) { 144 void BubbleDelegateView::GetAccessibleState(ui::AXViewState* state) {
143 state->role = ui::AX_ROLE_DIALOG; 145 state->role = ui::AX_ROLE_DIALOG;
(...skipping 26 matching lines...) Expand all
170 if (close_on_deactivate() && widget == GetWidget() && !active) 172 if (close_on_deactivate() && widget == GetWidget() && !active)
171 GetWidget()->Close(); 173 GetWidget()->Close();
172 } 174 }
173 175
174 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, 176 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget,
175 const gfx::Rect& new_bounds) { 177 const gfx::Rect& new_bounds) {
176 if (anchor_widget() == widget) 178 if (anchor_widget() == widget)
177 SizeToContents(); 179 SizeToContents();
178 } 180 }
179 181
182 const gfx::FontList& BubbleDelegateView::GetTitleFontList() const {
183 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
184 return rb.GetFontList(ui::ResourceBundle::MediumFont);
185 }
186
180 View* BubbleDelegateView::GetAnchorView() const { 187 View* BubbleDelegateView::GetAnchorView() const {
181 return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_); 188 return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_);
182 } 189 }
183 190
184 gfx::Rect BubbleDelegateView::GetAnchorRect() const { 191 gfx::Rect BubbleDelegateView::GetAnchorRect() const {
185 if (!GetAnchorView()) 192 if (!GetAnchorView())
186 return anchor_rect_; 193 return anchor_rect_;
187 194
188 anchor_rect_ = GetAnchorView()->GetBoundsInScreen(); 195 anchor_rect_ = GetAnchorView()->GetBoundsInScreen();
189 anchor_rect_.Inset(anchor_view_insets_); 196 anchor_rect_.Inset(anchor_view_insets_);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 if (widget == GetWidget() && anchor_widget() && 296 if (widget == GetWidget() && anchor_widget() &&
290 anchor_widget()->GetTopLevelWidget()) { 297 anchor_widget()->GetTopLevelWidget()) {
291 if (visible) 298 if (visible)
292 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); 299 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering();
293 else 300 else
294 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); 301 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering();
295 } 302 }
296 } 303 }
297 304
298 } // namespace views 305 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698