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

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

Issue 8604012: move chromeos bubble setup code to window.cc (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector>
Daniel Erat 2011/11/21 16:59:09 bubble_delegate.h should be included before anythi
alicet1 2011/11/21 20:58:45 Done.
6
5 #include "ui/views/bubble/bubble_delegate.h" 7 #include "ui/views/bubble/bubble_delegate.h"
6 8
7 #include "ui/base/animation/slide_animation.h" 9 #include "ui/base/animation/slide_animation.h"
8 #include "ui/views/bubble/bubble_frame_view.h" 10 #include "ui/views/bubble/bubble_frame_view.h"
9 #include "views/widget/widget.h" 11 #include "views/widget/widget.h"
10 12
13 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK)
14 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h"
15 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h"
16 #endif
17
11 // The duration of the fade animation in milliseconds. 18 // The duration of the fade animation in milliseconds.
12 static const int kHideFadeDurationMS = 200; 19 static const int kHideFadeDurationMS = 200;
13 20
14 namespace views { 21 namespace views {
15 22
16 namespace { 23 namespace {
17 24
18 // Create a widget to host the bubble. 25 // Create a widget to host the bubble.
19 Widget* CreateBubbleWidget(BubbleDelegateView* bubble, Widget* parent) { 26 Widget* CreateBubbleWidget(BubbleDelegateView* bubble, Widget* parent) {
20 Widget* bubble_widget = new Widget(); 27 Widget* bubble_widget = new Widget();
21 Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE); 28 Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE);
22 bubble_params.delegate = bubble; 29 bubble_params.delegate = bubble;
23 bubble_params.transparent = true; 30 bubble_params.transparent = true;
24 bubble_params.parent_widget = parent; 31 bubble_params.parent_widget = parent;
25 #if defined(OS_WIN) && !defined(USE_AURA) 32 #if defined(OS_WIN) && !defined(USE_AURA)
26 bubble_params.type = Widget::InitParams::TYPE_WINDOW_FRAMELESS; 33 bubble_params.type = Widget::InitParams::TYPE_WINDOW_FRAMELESS;
27 bubble_params.transparent = false; 34 bubble_params.transparent = false;
28 #endif 35 #endif
29 bubble_widget->Init(bubble_params); 36 bubble_widget->Init(bubble_params);
37 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK)
38 {
39 std::vector<int> params;
40 params.push_back(bubble->show_while_screen_is_locked());
41 chromeos::WmIpc::instance()->SetWindowType(
42 bubble_widget->GetNativeView(),
43 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
44 &params);
45 }
46 #endif
30 return bubble_widget; 47 return bubble_widget;
31 } 48 }
32 49
33 #if defined(OS_WIN) && !defined(USE_AURA) 50 #if defined(OS_WIN) && !defined(USE_AURA)
34 // The border widget's delegate, needed for transparent Windows native controls. 51 // The border widget's delegate, needed for transparent Windows native controls.
35 // TODO(msw): Remove this when Windows native controls are no longer needed. 52 // TODO(msw): Remove this when Windows native controls are no longer needed.
36 class VIEWS_EXPORT BubbleBorderDelegateView : public WidgetDelegateView { 53 class VIEWS_EXPORT BubbleBorderDelegateView : public WidgetDelegateView {
37 public: 54 public:
38 explicit BubbleBorderDelegateView(BubbleDelegateView* bubble) 55 explicit BubbleBorderDelegateView(BubbleDelegateView* bubble)
39 : bubble_(bubble) {} 56 : bubble_(bubble) {}
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } // namespace 89 } // namespace
73 90
74 BubbleDelegateView::BubbleDelegateView() 91 BubbleDelegateView::BubbleDelegateView()
75 : close_on_esc_(true), 92 : close_on_esc_(true),
76 close_on_deactivate_(true), 93 close_on_deactivate_(true),
77 allow_bubble_offscreen_(false), 94 allow_bubble_offscreen_(false),
78 anchor_view_(NULL), 95 anchor_view_(NULL),
79 arrow_location_(BubbleBorder::TOP_LEFT), 96 arrow_location_(BubbleBorder::TOP_LEFT),
80 color_(SK_ColorWHITE), 97 color_(SK_ColorWHITE),
81 border_widget_(NULL), 98 border_widget_(NULL),
82 use_focusless_(false) { 99 use_focusless_(false),
100 show_while_screen_is_locked_(false) {
83 set_background(views::Background::CreateSolidBackground(color_)); 101 set_background(views::Background::CreateSolidBackground(color_));
84 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, 0)); 102 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, 0));
85 } 103 }
86 104
87 BubbleDelegateView::BubbleDelegateView( 105 BubbleDelegateView::BubbleDelegateView(
88 View* anchor_view, 106 View* anchor_view,
89 BubbleBorder::ArrowLocation arrow_location, 107 BubbleBorder::ArrowLocation arrow_location,
90 const SkColor& color) 108 const SkColor& color)
91 : close_on_esc_(true), 109 : close_on_esc_(true),
92 close_on_deactivate_(true), 110 close_on_deactivate_(true),
93 allow_bubble_offscreen_(false), 111 allow_bubble_offscreen_(false),
94 anchor_view_(anchor_view), 112 anchor_view_(anchor_view),
95 arrow_location_(arrow_location), 113 arrow_location_(arrow_location),
96 color_(color), 114 color_(color),
97 original_opacity_(255), 115 original_opacity_(255),
98 border_widget_(NULL), 116 border_widget_(NULL),
99 use_focusless_(false) { 117 use_focusless_(false),
118 show_while_screen_is_locked_(false) {
100 set_background(views::Background::CreateSolidBackground(color_)); 119 set_background(views::Background::CreateSolidBackground(color_));
101 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, 0)); 120 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, 0));
102 } 121 }
103 122
104 BubbleDelegateView::~BubbleDelegateView() { 123 BubbleDelegateView::~BubbleDelegateView() {
105 if (border_widget_) 124 if (border_widget_)
106 border_widget_->Close(); 125 border_widget_->Close();
107 } 126 }
108 127
109 // static 128 // static
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 297
279 #if defined(OS_WIN) && !defined(USE_AURA) 298 #if defined(OS_WIN) && !defined(USE_AURA)
280 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { 299 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const {
281 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); 300 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView());
282 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin()); 301 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin());
283 return client_bounds; 302 return client_bounds;
284 } 303 }
285 #endif 304 #endif
286 305
287 } // namespace views 306 } // namespace views
OLDNEW
« ui/views/bubble/bubble_delegate.h ('K') | « ui/views/bubble/bubble_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698