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

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: use chrome/browser/uil/views/window.cc Created 9 years 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 | chrome/browser/ui/views/window.h » ('j') | chrome/browser/ui/views/window.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 "chrome/browser/ui/views/window.h"
19 #include "ui/gfx/screen.h" 20 #include "ui/gfx/screen.h"
20 #include "ui/views/bubble/bubble_delegate.h" 21 #include "ui/views/bubble/bubble_delegate.h"
21 #include "ui/views/layout/fill_layout.h" 22 #include "ui/views/layout/fill_layout.h"
22 #include "views/widget/root_view.h" 23 #include "views/widget/root_view.h"
23 24
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; 25 using base::TimeDelta;
30 using base::TimeTicks; 26 using base::TimeTicks;
31 using std::max; 27 using std::max;
32 using std::min; 28 using std::min;
33 29
34 namespace { 30 namespace {
35 31
36 // How long should the bubble be shown onscreen whenever the setting changes? 32 // How long should the bubble be shown onscreen whenever the setting changes?
37 const int kBubbleShowTimeoutMs = 1000; 33 const int kBubbleShowTimeoutMs = 1000;
38 34
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return (gfx::Point( 86 return (gfx::Point(
91 monitor_area.x() + kBubbleXRatio * monitor_area.width(), 87 monitor_area.x() + kBubbleXRatio * monitor_area.width(),
92 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap)); 88 monitor_area.bottom() - view_size.height() / 2 - kBubbleBottomGap));
93 } 89 }
94 90
95 SettingLevelBubbleDelegateView::SettingLevelBubbleDelegateView() 91 SettingLevelBubbleDelegateView::SettingLevelBubbleDelegateView()
96 : BubbleDelegateView(NULL, views::BubbleBorder::FLOAT, SK_ColorWHITE), 92 : BubbleDelegateView(NULL, views::BubbleBorder::FLOAT, SK_ColorWHITE),
97 view_(NULL) { 93 view_(NULL) {
98 set_close_on_esc(false); 94 set_close_on_esc(false);
99 set_use_focusless(true); 95 set_use_focusless(true);
96 set_show_while_screen_is_locked(true);
100 } 97 }
101 98
102 SettingLevelBubbleDelegateView::~SettingLevelBubbleDelegateView() { 99 SettingLevelBubbleDelegateView::~SettingLevelBubbleDelegateView() {
103 view_ = NULL; 100 view_ = NULL;
104 } 101 }
105 102
106 void SettingLevelBubbleDelegateView::Init() { 103 void SettingLevelBubbleDelegateView::Init() {
107 SetLayoutManager(new views::FillLayout()); 104 SetLayoutManager(new views::FillLayout());
108 view_ = new SettingLevelBubbleView(); 105 view_ = new SettingLevelBubbleView();
109 AddChildView(view_); 106 AddChildView(view_);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 current_percent_ = target_percent_; 178 current_percent_ = target_percent_;
182 target_time_ = TimeTicks(); 179 target_time_ = TimeTicks();
183 last_animation_update_time_ = TimeTicks(); 180 last_animation_update_time_ = TimeTicks();
184 last_target_update_time_ = TimeTicks(); 181 last_target_update_time_ = TimeTicks();
185 hide_timer_.Stop(); 182 hide_timer_.Stop();
186 StopAnimation(); 183 StopAnimation();
187 } 184 }
188 185
189 SettingLevelBubbleView* SettingLevelBubble::CreateView() { 186 SettingLevelBubbleView* SettingLevelBubble::CreateView() {
190 SettingLevelBubbleDelegateView* delegate = new SettingLevelBubbleDelegateView; 187 SettingLevelBubbleDelegateView* delegate = new SettingLevelBubbleDelegateView;
191 views::Widget* widget = views::BubbleDelegateView::CreateBubble(delegate); 188 views::Widget* widget = browser::CreateViewsBubble(delegate);
192 widget->AddObserver(this); 189 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. 190 // Hold on to the content view.
206 return delegate->view(); 191 return delegate->view();
207 } 192 }
208 193
209 void SettingLevelBubble::OnHideTimeout() { 194 void SettingLevelBubble::OnHideTimeout() {
210 // Start fading away. 195 // Start fading away.
211 if (view_) { 196 if (view_) {
212 SettingLevelBubbleDelegateView* delegate = 197 SettingLevelBubbleDelegateView* delegate =
213 static_cast<SettingLevelBubbleDelegateView*> 198 static_cast<SettingLevelBubbleDelegateView*>
214 (view_->GetWidget()->widget_delegate()); 199 (view_->GetWidget()->widget_delegate());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 256
272 last_target_update_time_ = now; 257 last_target_update_time_ = now;
273 } 258 }
274 259
275 void SettingLevelBubble::StopAnimation() { 260 void SettingLevelBubble::StopAnimation() {
276 animation_timer_.Stop(); 261 animation_timer_.Stop();
277 is_animating_ = false; 262 is_animating_ = false;
278 } 263 }
279 264
280 } // namespace chromeos 265 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/window.h » ('j') | chrome/browser/ui/views/window.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698