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

Side by Side Diff: ash/screensaver/screensaver_view.cc

Issue 12093058: Screensaver implementation for ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fixes. Created 7 years, 10 months 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 | « ash/screensaver/screensaver_view.h ('k') | ash/screensaver/screensaver_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 21 matching lines...) Expand all
32 namespace ash { 32 namespace ash {
33 33
34 void ShowScreensaver(const GURL& url) { 34 void ShowScreensaver(const GURL& url) {
35 internal::ScreensaverView::ShowScreensaver(url); 35 internal::ScreensaverView::ShowScreensaver(url);
36 } 36 }
37 37
38 void CloseScreensaver() { 38 void CloseScreensaver() {
39 internal::ScreensaverView::CloseScreensaver(); 39 internal::ScreensaverView::CloseScreensaver();
40 } 40 }
41 41
42 bool IsScreensaverShown() {
43 return internal::ScreensaverView::IsScreensaverShown();
44 }
45
42 namespace internal { 46 namespace internal {
43 47
44 // static 48 // static
45 void ScreensaverView::ShowScreensaver(const GURL& url) { 49 void ScreensaverView::ShowScreensaver(const GURL& url) {
46 if (!g_instance) { 50 if (!g_instance) {
47 g_instance = new ScreensaverView(url); 51 g_instance = new ScreensaverView(url);
48 g_instance->Show(); 52 g_instance->Show();
49 } 53 }
50 } 54 }
51 55
52 // static 56 // static
53 void ScreensaverView::CloseScreensaver() { 57 void ScreensaverView::CloseScreensaver() {
54 if (g_instance) { 58 if (g_instance) {
55 g_instance->Close(); 59 g_instance->Close();
56 g_instance = NULL; 60 g_instance = NULL;
57 } 61 }
58 } 62 }
59 63
64 // static
65 bool ScreensaverView::IsScreensaverShown() {
66 return g_instance && g_instance->IsScreensaverShowingURL(g_instance->url_);
67 }
68
69 bool ScreensaverView::IsScreensaverShowingURL(const GURL& url) {
70 return screensaver_webview_ &&
71 screensaver_webview_->web_contents() &&
72 (screensaver_webview_->web_contents()->GetURL() == url);
73 }
74
60 //////////////////////////////////////////////////////////////////////////////// 75 ////////////////////////////////////////////////////////////////////////////////
61 // ScreensaverView, views::WidgetDelegateView implementation. 76 // ScreensaverView, views::WidgetDelegateView implementation.
62 views::View* ScreensaverView::GetContentsView() { 77 views::View* ScreensaverView::GetContentsView() {
63 return this; 78 return this;
64 } 79 }
65 80
66 //////////////////////////////////////////////////////////////////////////////// 81 ////////////////////////////////////////////////////////////////////////////////
67 // ScreensaverView, content::WebContentsObserver implementation. 82 // ScreensaverView, content::WebContentsObserver implementation.
68 void ScreensaverView::RenderViewGone( 83 void ScreensaverView::RenderViewGone(
69 base::TerminationStatus status) { 84 base::TerminationStatus status) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 container_window_->Show(); 161 container_window_->Show();
147 } 162 }
148 163
149 // static 164 // static
150 ScreensaverView* ScreensaverView::GetInstance() { 165 ScreensaverView* ScreensaverView::GetInstance() {
151 return g_instance; 166 return g_instance;
152 } 167 }
153 168
154 } // namespace internal 169 } // namespace internal
155 } // namespace ash 170 } // namespace ash
OLDNEW
« no previous file with comments | « ash/screensaver/screensaver_view.h ('k') | ash/screensaver/screensaver_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698