| OLD | NEW |
| 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 <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 namespace chromeos { | 54 namespace chromeos { |
| 55 | 55 |
| 56 // Temporary helper routine. Tries to first return the widget from the | 56 // Temporary helper routine. Tries to first return the widget from the |
| 57 // most-recently-focused normal browser window, then from a login | 57 // most-recently-focused normal browser window, then from a login |
| 58 // background, and finally NULL if both of those fail. | 58 // background, and finally NULL if both of those fail. |
| 59 // TODO(glotov): remove this in favor of enabling Bubble class act | 59 // TODO(glotov): remove this in favor of enabling Bubble class act |
| 60 // without |parent| specified. crosbug.com/4025 | 60 // without |parent| specified. crosbug.com/4025 |
| 61 static views::Widget* GetToplevelWidget() { | 61 static views::Widget* GetToplevelWidget() { |
| 62 #if defined(USE_AURA) |
| 63 // TODO(saintlou): Need to fix in PureViews. |
| 64 return WebUILoginDisplay::GetLoginWindow(); |
| 65 #else |
| 62 GtkWindow* window = NULL; | 66 GtkWindow* window = NULL; |
| 63 | 67 |
| 64 // We just use the default profile here -- this gets overridden as needed | 68 // We just use the default profile here -- this gets overridden as needed |
| 65 // in Chrome OS depending on whether the user is logged in or not. | 69 // in Chrome OS depending on whether the user is logged in or not. |
| 66 Browser* browser = | 70 Browser* browser = |
| 67 BrowserList::FindTabbedBrowser( | 71 BrowserList::FindTabbedBrowser( |
| 68 ProfileManager::GetDefaultProfile(), | 72 ProfileManager::GetDefaultProfile(), |
| 69 true); // match_incognito | 73 true); // match_incognito |
| 70 if (browser) { | 74 if (browser) { |
| 71 window = GTK_WINDOW(browser->window()->GetNativeHandle()); | 75 window = GTK_WINDOW(browser->window()->GetNativeHandle()); |
| 72 } else { | 76 } else { |
| 73 // Otherwise, see if there's a background window that we can use. | 77 // Otherwise, see if there's a background window that we can use. |
| 74 BackgroundView* background = LoginUtils::Get()->GetBackgroundView(); | 78 BackgroundView* background = LoginUtils::Get()->GetBackgroundView(); |
| 75 if (background) | 79 if (background) |
| 76 window = GTK_WINDOW(background->GetNativeWindow()); | 80 window = GTK_WINDOW(background->GetNativeWindow()); |
| 77 } | 81 } |
| 78 | 82 |
| 79 if (window) | 83 if (window) |
| 80 return views::Widget::GetWidgetForNativeWindow(window); | 84 return views::Widget::GetWidgetForNativeWindow(window); |
| 81 else | 85 else |
| 82 return WebUILoginDisplay::GetLoginWindow(); | 86 return WebUILoginDisplay::GetLoginWindow(); |
| 87 #endif |
| 83 } | 88 } |
| 84 | 89 |
| 85 SettingLevelBubble::SettingLevelBubble(SkBitmap* increase_icon, | 90 SettingLevelBubble::SettingLevelBubble(SkBitmap* increase_icon, |
| 86 SkBitmap* decrease_icon, | 91 SkBitmap* decrease_icon, |
| 87 SkBitmap* disabled_icon) | 92 SkBitmap* disabled_icon) |
| 88 : current_percent_(-1.0), | 93 : current_percent_(-1.0), |
| 89 target_percent_(-1.0), | 94 target_percent_(-1.0), |
| 90 increase_icon_(increase_icon), | 95 increase_icon_(increase_icon), |
| 91 decrease_icon_(decrease_icon), | 96 decrease_icon_(decrease_icon), |
| 92 disabled_icon_(disabled_icon), | 97 disabled_icon_(disabled_icon), |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 249 |
| 245 last_target_update_time_ = now; | 250 last_target_update_time_ = now; |
| 246 } | 251 } |
| 247 | 252 |
| 248 void SettingLevelBubble::StopAnimation() { | 253 void SettingLevelBubble::StopAnimation() { |
| 249 animation_timer_.Stop(); | 254 animation_timer_.Stop(); |
| 250 is_animating_ = false; | 255 is_animating_ = false; |
| 251 } | 256 } |
| 252 | 257 |
| 253 } // namespace chromeos | 258 } // namespace chromeos |
| OLD | NEW |