OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/screensaver/screensaver_view.h" | 5 #include "ash/screensaver/screensaver_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
15 #include "ui/gfx/screen.h" | 15 #include "ui/gfx/screen.h" |
16 #include "ui/views/controls/webview/webview.h" | 16 #include "ui/views/controls/webview/webview.h" |
17 #include "ui/views/layout/fill_layout.h" | 17 #include "ui/views/layout/fill_layout.h" |
18 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
19 | 19 |
20 using content::BrowserThread; | 20 using content::BrowserThread; |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 ash::internal::ScreensaverView* g_instance = NULL; | 24 ash::ScreensaverView* g_instance = NULL; |
25 | 25 |
26 // Do not restart the screensaver again if it has | 26 // Do not restart the screensaver again if it has |
27 // terminated kMaxTerminations times already. | 27 // terminated kMaxTerminations times already. |
28 const int kMaxTerminations = 3; | 28 const int kMaxTerminations = 3; |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 namespace ash { | 32 namespace ash { |
33 | 33 |
34 void ShowScreensaver(const GURL& url) { | 34 void ShowScreensaver(const GURL& url) { ScreensaverView::ShowScreensaver(url); } |
35 internal::ScreensaverView::ShowScreensaver(url); | |
36 } | |
37 | 35 |
38 void CloseScreensaver() { | 36 void CloseScreensaver() { ScreensaverView::CloseScreensaver(); } |
39 internal::ScreensaverView::CloseScreensaver(); | |
40 } | |
41 | 37 |
42 bool IsScreensaverShown() { | 38 bool IsScreensaverShown() { return ScreensaverView::IsScreensaverShown(); } |
43 return internal::ScreensaverView::IsScreensaverShown(); | |
44 } | |
45 | |
46 namespace internal { | |
47 | 39 |
48 // static | 40 // static |
49 void ScreensaverView::ShowScreensaver(const GURL& url) { | 41 void ScreensaverView::ShowScreensaver(const GURL& url) { |
50 if (!g_instance) { | 42 if (!g_instance) { |
51 g_instance = new ScreensaverView(url); | 43 g_instance = new ScreensaverView(url); |
52 g_instance->Show(); | 44 g_instance->Show(); |
53 } | 45 } |
54 } | 46 } |
55 | 47 |
56 // static | 48 // static |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 container_window_->StackAtTop(); | 151 container_window_->StackAtTop(); |
160 container_window_->SetBounds(screen_rect); | 152 container_window_->SetBounds(screen_rect); |
161 container_window_->Show(); | 153 container_window_->Show(); |
162 } | 154 } |
163 | 155 |
164 // static | 156 // static |
165 ScreensaverView* ScreensaverView::GetInstance() { | 157 ScreensaverView* ScreensaverView::GetInstance() { |
166 return g_instance; | 158 return g_instance; |
167 } | 159 } |
168 | 160 |
169 } // namespace internal | |
170 } // namespace ash | 161 } // namespace ash |
OLD | NEW |