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

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

Issue 413433002: Refactor BubbleDelegateView::use_focuseless() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit + rebase Created 6 years, 4 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
« no previous file with comments | « ui/views/bubble/bubble_delegate.h ('k') | ui/views/touchui/touch_editing_menu.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 "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/base/resource/resource_bundle.h"
9 #include "ui/gfx/color_utils.h" 9 #include "ui/gfx/color_utils.h"
10 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 BubbleDelegateView::BubbleDelegateView() 48 BubbleDelegateView::BubbleDelegateView()
49 : close_on_esc_(true), 49 : close_on_esc_(true),
50 close_on_deactivate_(true), 50 close_on_deactivate_(true),
51 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), 51 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()),
52 anchor_widget_(NULL), 52 anchor_widget_(NULL),
53 arrow_(BubbleBorder::TOP_LEFT), 53 arrow_(BubbleBorder::TOP_LEFT),
54 shadow_(BubbleBorder::SMALL_SHADOW), 54 shadow_(BubbleBorder::SMALL_SHADOW),
55 color_explicitly_set_(false), 55 color_explicitly_set_(false),
56 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), 56 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin),
57 use_focusless_(false), 57 can_activate_(true),
58 accept_events_(true), 58 accept_events_(true),
59 border_accepts_events_(true), 59 border_accepts_events_(true),
60 adjust_if_offscreen_(true), 60 adjust_if_offscreen_(true),
61 parent_window_(NULL) { 61 parent_window_(NULL) {
62 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); 62 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
63 UpdateColorsFromTheme(GetNativeTheme()); 63 UpdateColorsFromTheme(GetNativeTheme());
64 } 64 }
65 65
66 BubbleDelegateView::BubbleDelegateView( 66 BubbleDelegateView::BubbleDelegateView(
67 View* anchor_view, 67 View* anchor_view,
68 BubbleBorder::Arrow arrow) 68 BubbleBorder::Arrow arrow)
69 : close_on_esc_(true), 69 : close_on_esc_(true),
70 close_on_deactivate_(true), 70 close_on_deactivate_(true),
71 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), 71 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()),
72 anchor_widget_(NULL), 72 anchor_widget_(NULL),
73 arrow_(arrow), 73 arrow_(arrow),
74 shadow_(BubbleBorder::SMALL_SHADOW), 74 shadow_(BubbleBorder::SMALL_SHADOW),
75 color_explicitly_set_(false), 75 color_explicitly_set_(false),
76 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), 76 margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin),
77 use_focusless_(false), 77 can_activate_(true),
78 accept_events_(true), 78 accept_events_(true),
79 border_accepts_events_(true), 79 border_accepts_events_(true),
80 adjust_if_offscreen_(true), 80 adjust_if_offscreen_(true),
81 parent_window_(NULL) { 81 parent_window_(NULL) {
82 SetAnchorView(anchor_view); 82 SetAnchorView(anchor_view);
83 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); 83 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
84 UpdateColorsFromTheme(GetNativeTheme()); 84 UpdateColorsFromTheme(GetNativeTheme());
85 } 85 }
86 86
87 BubbleDelegateView::~BubbleDelegateView() { 87 BubbleDelegateView::~BubbleDelegateView() {
(...skipping 23 matching lines...) Expand all
111 bubble_delegate->SizeToContents(); 111 bubble_delegate->SizeToContents();
112 bubble_widget->AddObserver(bubble_delegate); 112 bubble_widget->AddObserver(bubble_delegate);
113 return bubble_widget; 113 return bubble_widget;
114 } 114 }
115 115
116 BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() { 116 BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() {
117 return this; 117 return this;
118 } 118 }
119 119
120 bool BubbleDelegateView::CanActivate() const { 120 bool BubbleDelegateView::CanActivate() const {
121 return !use_focusless(); 121 return can_activate();
122 } 122 }
123 123
124 bool BubbleDelegateView::ShouldShowCloseButton() const { 124 bool BubbleDelegateView::ShouldShowCloseButton() const {
125 return false; 125 return false;
126 } 126 }
127 127
128 View* BubbleDelegateView::GetContentsView() { 128 View* BubbleDelegateView::GetContentsView() {
129 return this; 129 return this;
130 } 130 }
131 131
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 if (widget == GetWidget() && anchor_widget() && 300 if (widget == GetWidget() && anchor_widget() &&
301 anchor_widget()->GetTopLevelWidget()) { 301 anchor_widget()->GetTopLevelWidget()) {
302 if (visible) 302 if (visible)
303 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); 303 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering();
304 else 304 else
305 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); 305 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering();
306 } 306 }
307 } 307 }
308 308
309 } // namespace views 309 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_delegate.h ('k') | ui/views/touchui/touch_editing_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698