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

Side by Side Diff: chrome/browser/chromeos/setting_level_bubble.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
« no previous file with comments | « no previous file | ui/views/bubble/bubble_delegate.h » ('j') | ui/views/bubble/bubble_delegate.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/chromeos/setting_level_bubble.h" 5 #include "chrome/browser/chromeos/setting_level_bubble.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/chromeos/login/background_view.h" 9 #include "chrome/browser/chromeos/login/background_view.h"
10 #include "chrome/browser/chromeos/login/base_login_display_host.h" 10 #include "chrome/browser/chromeos/login/base_login_display_host.h"
11 #include "chrome/browser/chromeos/login/login_display_host.h" 11 #include "chrome/browser/chromeos/login/login_display_host.h"
12 #include "chrome/browser/chromeos/login/login_utils.h" 12 #include "chrome/browser/chromeos/login/login_utils.h"
13 #include "chrome/browser/chromeos/login/webui_login_display.h" 13 #include "chrome/browser/chromeos/login/webui_login_display.h"
14 #include "chrome/browser/chromeos/setting_level_bubble_view.h" 14 #include "chrome/browser/chromeos/setting_level_bubble_view.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
20 #include "ui/views/bubble/bubble_delegate.h" 20 #include "ui/views/bubble/bubble_delegate.h"
21 #include "ui/views/layout/fill_layout.h" 21 #include "ui/views/layout/fill_layout.h"
22 #include "views/widget/root_view.h" 22 #include "views/widget/root_view.h"
23 23
24 #if !defined(USE_AURA)
25 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h"
26 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h"
27 #endif
28
29 using base::TimeDelta; 24 using base::TimeDelta;
30 using base::TimeTicks; 25 using base::TimeTicks;
31 using std::max; 26 using std::max;
32 using std::min; 27 using std::min;
33 28
34 namespace { 29 namespace {
35 30
36 // How long should the bubble be shown onscreen whenever the setting changes? 31 // How long should the bubble be shown onscreen whenever the setting changes?
37 const int kBubbleShowTimeoutMs = 1000; 32 const int kBubbleShowTimeoutMs = 1000;
38 33
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return (gfx::Point( 85 return (gfx::Point(
91 monitor_area.x() + kBubbleXRatio * monitor_area.width(), 86 monitor_area.x() + kBubbleXRatio * monitor_area.width(),
92 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap)); 87 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap));
93 } 88 }
94 89
95 SettingLevelBubbleDelegateView::SettingLevelBubbleDelegateView() 90 SettingLevelBubbleDelegateView::SettingLevelBubbleDelegateView()
96 : BubbleDelegateView(NULL, views::BubbleBorder::FLOAT, SK_ColorWHITE), 91 : BubbleDelegateView(NULL, views::BubbleBorder::FLOAT, SK_ColorWHITE),
97 view_(NULL) { 92 view_(NULL) {
98 set_close_on_esc(false); 93 set_close_on_esc(false);
99 set_use_focusless(true); 94 set_use_focusless(true);
95 set_show_while_screen_is_locked(true);
100 } 96 }
101 97
102 SettingLevelBubbleDelegateView::~SettingLevelBubbleDelegateView() { 98 SettingLevelBubbleDelegateView::~SettingLevelBubbleDelegateView() {
103 view_ = NULL; 99 view_ = NULL;
104 } 100 }
105 101
106 void SettingLevelBubbleDelegateView::Init() { 102 void SettingLevelBubbleDelegateView::Init() {
107 SetLayoutManager(new views::FillLayout()); 103 SetLayoutManager(new views::FillLayout());
108 view_ = new SettingLevelBubbleView(); 104 view_ = new SettingLevelBubbleView();
109 AddChildView(view_); 105 AddChildView(view_);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 last_animation_update_time_ = TimeTicks(); 179 last_animation_update_time_ = TimeTicks();
184 last_target_update_time_ = TimeTicks(); 180 last_target_update_time_ = TimeTicks();
185 hide_timer_.Stop(); 181 hide_timer_.Stop();
186 StopAnimation(); 182 StopAnimation();
187 } 183 }
188 184
189 SettingLevelBubbleView* SettingLevelBubble::CreateView() { 185 SettingLevelBubbleView* SettingLevelBubble::CreateView() {
190 SettingLevelBubbleDelegateView* delegate = new SettingLevelBubbleDelegateView; 186 SettingLevelBubbleDelegateView* delegate = new SettingLevelBubbleDelegateView;
191 views::Widget* widget = views::BubbleDelegateView::CreateBubble(delegate); 187 views::Widget* widget = views::BubbleDelegateView::CreateBubble(delegate);
192 widget->AddObserver(this); 188 widget->AddObserver(this);
193
194 #if !defined(USE_AURA)
195 {
196 std::vector<int> params;
197 params.push_back(1); // show_while_screen_is_locked_
198 chromeos::WmIpc::instance()->SetWindowType(
199 widget->GetNativeView(),
200 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE,
201 &params);
202 }
203 #endif
204
205 // Hold on to the content view. 189 // Hold on to the content view.
206 return delegate->view(); 190 return delegate->view();
207 } 191 }
208 192
209 void SettingLevelBubble::OnHideTimeout() { 193 void SettingLevelBubble::OnHideTimeout() {
210 // Start fading away. 194 // Start fading away.
211 if (view_) { 195 if (view_) {
212 SettingLevelBubbleDelegateView* delegate = 196 SettingLevelBubbleDelegateView* delegate =
213 static_cast<SettingLevelBubbleDelegateView*> 197 static_cast<SettingLevelBubbleDelegateView*>
214 (view_->GetWidget()->widget_delegate()); 198 (view_->GetWidget()->widget_delegate());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 255
272 last_target_update_time_ = now; 256 last_target_update_time_ = now;
273 } 257 }
274 258
275 void SettingLevelBubble::StopAnimation() { 259 void SettingLevelBubble::StopAnimation() {
276 animation_timer_.Stop(); 260 animation_timer_.Stop();
277 is_animating_ = false; 261 is_animating_ = false;
278 } 262 }
279 263
280 } // namespace chromeos 264 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_delegate.h » ('j') | ui/views/bubble/bubble_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698