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 "chrome/browser/chromeos/login/background_view.h" | 9 #include "chrome/browser/chromeos/login/background_view.h" |
| 10 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
10 #include "chrome/browser/chromeos/login/login_utils.h" | 11 #include "chrome/browser/chromeos/login/login_utils.h" |
| 12 #include "chrome/browser/chromeos/login/login_display_host.h" |
11 #include "chrome/browser/chromeos/login/webui_login_display.h" | 13 #include "chrome/browser/chromeos/login/webui_login_display.h" |
12 #include "chrome/browser/chromeos/setting_level_bubble_view.h" | 14 #include "chrome/browser/chromeos/setting_level_bubble_view.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
16 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
17 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
18 #include "views/bubble/bubble_delegate.h" | 20 #include "views/bubble/bubble_delegate.h" |
19 #include "views/layout/fill_layout.h" | 21 #include "views/layout/fill_layout.h" |
20 #include "views/widget/root_view.h" | 22 #include "views/widget/root_view.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 ProfileManager::GetDefaultProfile(), | 69 ProfileManager::GetDefaultProfile(), |
68 true); // match_incognito | 70 true); // match_incognito |
69 if (browser) { | 71 if (browser) { |
70 window = browser->window()->GetNativeHandle(); | 72 window = browser->window()->GetNativeHandle(); |
71 } else { | 73 } else { |
72 #if defined(USE_AURA) | 74 #if defined(USE_AURA) |
73 // TODO(saintlou): Unsure what to do for the Aura background. | 75 // TODO(saintlou): Unsure what to do for the Aura background. |
74 #else | 76 #else |
75 // 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. |
76 BackgroundView* background = LoginUtils::Get()->GetBackgroundView(); | 78 BackgroundView* background = LoginUtils::Get()->GetBackgroundView(); |
77 if (background) | 79 if (background) { |
78 window = GTK_WINDOW(background->GetNativeWindow()); | 80 window = GTK_WINDOW(background->GetNativeWindow()); |
| 81 } else { |
| 82 ExistingUserController* controller = |
| 83 ExistingUserController::current_controller(); |
| 84 if (controller) { |
| 85 window = |
| 86 GTK_WINDOW(controller->login_display_host()->GetNativeWindow()); |
| 87 } |
| 88 } |
79 #endif | 89 #endif |
80 } | 90 } |
81 | 91 |
82 if (window) | 92 if (window) { |
83 return views::Widget::GetWidgetForNativeWindow(window); | 93 return views::Widget::GetWidgetForNativeWindow(window); |
84 else | 94 } else { |
85 return WebUILoginDisplay::GetLoginWindow(); | 95 NOTREACHED(); |
| 96 return NULL; |
| 97 } |
86 } | 98 } |
87 | 99 |
88 // SettingLevelBubbleDelegateView ---------------------------------------------- | 100 // SettingLevelBubbleDelegateView ---------------------------------------------- |
89 class SettingLevelBubbleDelegateView : public views::BubbleDelegateView { | 101 class SettingLevelBubbleDelegateView : public views::BubbleDelegateView { |
90 public: | 102 public: |
91 // BubbleDelegate overrides: | 103 // BubbleDelegate overrides: |
92 virtual gfx::Point GetAnchorPoint() OVERRIDE; | 104 virtual gfx::Point GetAnchorPoint() OVERRIDE; |
93 | 105 |
94 // Create the bubble delegate view. | 106 // Create the bubble delegate view. |
95 explicit SettingLevelBubbleDelegateView(views::Widget* parent); | 107 explicit SettingLevelBubbleDelegateView(views::Widget* parent); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 307 |
296 last_target_update_time_ = now; | 308 last_target_update_time_ = now; |
297 } | 309 } |
298 | 310 |
299 void SettingLevelBubble::StopAnimation() { | 311 void SettingLevelBubble::StopAnimation() { |
300 animation_timer_.Stop(); | 312 animation_timer_.Stop(); |
301 is_animating_ = false; | 313 is_animating_ = false; |
302 } | 314 } |
303 | 315 |
304 } // namespace chromeos | 316 } // namespace chromeos |
OLD | NEW |