summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc13
-rw-r--r--chrome/browser/chromeos/ui/screensaver_extension_dialog.cc109
-rw-r--r--chrome/browser/chromeos/ui/screensaver_extension_dialog.h58
-rw-r--r--chrome/browser/ui/views/accessibility_event_router_views_unittest.cc6
-rw-r--r--chrome/browser/ui/views/ash/chrome_shell_delegate.cc4
-rw-r--r--chrome/browser/ui/views/ash/chrome_shell_delegate.h1
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc6
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.cc6
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.h4
-rw-r--r--chrome/browser/ui/views/menu_model_adapter_test.cc6
-rw-r--r--chrome/chrome_browser.gypi2
11 files changed, 42 insertions, 173 deletions
diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc
index 9bdfb33..68f725e 100644
--- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc
+++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h"
+#include "ash/screensaver/screensaver_view.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/lazy_instance.h"
@@ -11,7 +12,7 @@
#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/chromeos/ui/screensaver_extension_dialog.h"
+#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
@@ -173,7 +174,11 @@ void KioskModeScreensaver::SetupScreensaver(
chromeos::DBusThreadManager::Get()->
GetPowerManagerClient()->RequestActiveNotification();
- browser::ShowScreensaverDialog(extension);
+ // Add the extension to the extension service and display the screensaver.
+ Profile* default_profile = ProfileManager::GetDefaultProfile();
+ default_profile->GetExtensionService()->AddExtension(extension);
+
+ ash::ShowScreensaver(extension->GetFullLaunchURL());
}
// NotificationObserver overrides:
@@ -188,7 +193,7 @@ void KioskModeScreensaver::Observe(
if (power_manager->HasObserver(this))
power_manager->RemoveObserver(this);
- browser::CloseScreensaverDialog();
+ ash::CloseScreensaver();
ShutdownKioskModeScreensaver();
}
@@ -203,7 +208,7 @@ void KioskModeScreensaver::ActiveNotify() {
} else {
// Remove the screensaver so the user can at least use the underlying
// login screen to be able to log in.
- browser::CloseScreensaverDialog();
+ ash::CloseScreensaver();
}
}
diff --git a/chrome/browser/chromeos/ui/screensaver_extension_dialog.cc b/chrome/browser/chromeos/ui/screensaver_extension_dialog.cc
deleted file mode 100644
index c8bd9e7..0000000
--- a/chrome/browser/chromeos/ui/screensaver_extension_dialog.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/ui/screensaver_extension_dialog.h"
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/memory/ref_counted.h"
-#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/sessions/restore_tab_helper.h"
-#include "chrome/browser/ui/views/extensions/extension_dialog.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/extension_file_util.h"
-
-using content::BrowserThread;
-
-namespace {
-
-ScreensaverExtensionDialog* g_instance = NULL;
-
-} // namespace
-
-namespace browser {
-
-void ShowScreensaverDialog(scoped_refptr<Extension> extension) {
- ScreensaverExtensionDialog::ShowScreensaverDialog(extension);
-}
-
-void CloseScreensaverDialog() {
- ScreensaverExtensionDialog::CloseScreensaverDialog();
-}
-
-} // namespace browser
-
-// static
-void ScreensaverExtensionDialog::ShowScreensaverDialog(
- scoped_refptr<Extension> extension) {
- if (!g_instance)
- g_instance = new ScreensaverExtensionDialog(extension);
- g_instance->Show();
-}
-
-// static
-void ScreensaverExtensionDialog::CloseScreensaverDialog() {
- if (g_instance)
- g_instance->Close();
-}
-
-ScreensaverExtensionDialog::ScreensaverExtensionDialog(
- scoped_refptr<Extension> extension)
- : screensaver_extension_(extension) {
-}
-
-void ScreensaverExtensionDialog::Show() {
- if (!screensaver_extension_)
- return;
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- Profile* default_profile = ProfileManager::GetDefaultProfile();
- default_profile->GetExtensionService()->AddExtension(screensaver_extension_);
- extension_dialog_ = ExtensionDialog::ShowFullscreen(
- screensaver_extension_->GetFullLaunchURL(),
- default_profile,
- string16(),
- this);
-}
-
-void ScreensaverExtensionDialog::Close() {
- if (extension_dialog_) {
- extension_dialog_->Close();
- extension_dialog_ = NULL;
- }
-}
-
-ScreensaverExtensionDialog::~ScreensaverExtensionDialog() {
- if (extension_dialog_)
- extension_dialog_->ObserverDestroyed();
-}
-
-void ScreensaverExtensionDialog::ExtensionDialogClosing(
- ExtensionDialog* dialog) {
- // Release our reference to the dialog to allow it to close.
- extension_dialog_ = NULL;
-}
-
-void ScreensaverExtensionDialog::ExtensionTerminated(
- ExtensionDialog* dialog) {
- // This needs to be run 'slightly' delayed. When we get the extension
- // terminated notification, the extension isn't fully unloaded yet. There
- // is no good way to get around this. The correct solution will be to
- // not need to reload the extension at all - but the current wiring in
- // ExtensionViewsHost makes that not possible.
- MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&ScreensaverExtensionDialog::ReloadAndShow,
- base::Unretained(this)));
- dialog->Close();
-}
-
-void ScreensaverExtensionDialog::ReloadAndShow() {
- ProfileManager::GetDefaultProfile()->GetExtensionService()->ReloadExtension(
- screensaver_extension_->id());
-
- Show();
-}
diff --git a/chrome/browser/chromeos/ui/screensaver_extension_dialog.h b/chrome/browser/chromeos/ui/screensaver_extension_dialog.h
deleted file mode 100644
index 6da2683..0000000
--- a/chrome/browser/chromeos/ui/screensaver_extension_dialog.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_UI_SCREENSAVER_EXTENSION_DIALOG_H_
-#define CHROME_BROWSER_CHROMEOS_UI_SCREENSAVER_EXTENSION_DIALOG_H_
-#pragma once
-
-#include "base/memory/ref_counted.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/views/extensions/extension_dialog_observer.h"
-
-class Extension;
-class ExtensionDialog;
-
-namespace browser {
-
-void ShowScreensaverDialog(scoped_refptr<Extension> extension);
-void CloseScreensaverDialog();
-
-} // namespace browser
-
-// Shows or hides the screensaver extension in fullscreen mode on
-// top of all other windows.
-class ScreensaverExtensionDialog : public ExtensionDialogObserver {
- public:
- static void ShowScreensaverDialog(scoped_refptr<Extension> extension);
- static void CloseScreensaverDialog();
-
- // ExtensionDialog::Observer implementation.
- virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE;
- virtual void ExtensionTerminated(ExtensionDialog* dialog) OVERRIDE;
-
- protected:
- virtual void Show();
- virtual void Close();
-
- private:
- friend class ScreensaverExtensionDialogBrowserTest;
- friend class ScreensaverExtensionDialogTest;
-
- explicit ScreensaverExtensionDialog(scoped_refptr<Extension> extension);
- virtual ~ScreensaverExtensionDialog();
-
- // Reload the screensaver extension and show another screensaver dialog.
- void ReloadAndShow();
-
- scoped_refptr<Extension> screensaver_extension_;
- // Host for the extension that implements this dialog.
- scoped_refptr<ExtensionDialog> extension_dialog_;
-
- // Set while we're loading an extension; only touched from the UI thread.
- bool loading_extension_;
-
- DISALLOW_COPY_AND_ASSIGN(ScreensaverExtensionDialog);
-};
-
-#endif // CHROME_BROWSER_CHROMEOS_UI_SCREENSAVER_EXTENSION_DIALOG_H_
diff --git a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
index 981db9b..82ad589 100644
--- a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
+++ b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc
@@ -90,6 +90,12 @@ class AccessibilityViewsDelegate : public views::ViewsDelegate {
}
#endif
+ virtual content::WebContents* CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) OVERRIDE {
+ return NULL;
+ }
+
DISALLOW_COPY_AND_ASSIGN(AccessibilityViewsDelegate);
};
diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
index 368d798..3e29621 100644
--- a/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.cc
@@ -186,6 +186,10 @@ void ChromeShellDelegate::OpenMobileSetup() {
#endif
}
+content::BrowserContext* ChromeShellDelegate::GetCurrentBrowserContext() {
+ return ProfileManager::GetDefaultProfile();
+}
+
ash::AppListViewDelegate*
ChromeShellDelegate::CreateAppListViewDelegate() {
// Shell will own the created delegate.
diff --git a/chrome/browser/ui/views/ash/chrome_shell_delegate.h b/chrome/browser/ui/views/ash/chrome_shell_delegate.h
index 7a71f49..9415ce4 100644
--- a/chrome/browser/ui/views/ash/chrome_shell_delegate.h
+++ b/chrome/browser/ui/views/ash/chrome_shell_delegate.h
@@ -42,6 +42,7 @@ class ChromeShellDelegate : public ash::ShellDelegate,
virtual void OpenFileManager() OVERRIDE;
virtual void OpenCrosh() OVERRIDE;
virtual void OpenMobileSetup() OVERRIDE;
+ virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE;
virtual ash::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
virtual void StartPartialScreenshot(
ash::ScreenshotDelegate* screenshot_delegate) OVERRIDE;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
index 62465f5..cb5d34d 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
@@ -128,6 +128,12 @@ class ViewsDelegateImpl : public views::ViewsDelegate {
}
#endif
+ virtual content::WebContents* CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) OVERRIDE {
+ return NULL;
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(ViewsDelegateImpl);
};
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index 51c573e..5b6b3e3 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -170,3 +170,9 @@ views::NativeWidgetHelperAura* ChromeViewsDelegate::CreateNativeWidgetHelper(
#endif
}
#endif
+
+content::WebContents* ChromeViewsDelegate::CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) {
+ return NULL;
+}
diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h
index c7e4b7c..963150d 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.h
+++ b/chrome/browser/ui/views/chrome_views_delegate.h
@@ -51,6 +51,10 @@ class ChromeViewsDelegate : public views::ViewsDelegate {
views::NativeWidgetAura* native_widget) OVERRIDE;
#endif
+ virtual content::WebContents* CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) OVERRIDE;
+
private:
DISALLOW_COPY_AND_ASSIGN(ChromeViewsDelegate);
};
diff --git a/chrome/browser/ui/views/menu_model_adapter_test.cc b/chrome/browser/ui/views/menu_model_adapter_test.cc
index 740ec42..98a6683 100644
--- a/chrome/browser/ui/views/menu_model_adapter_test.cc
+++ b/chrome/browser/ui/views/menu_model_adapter_test.cc
@@ -95,6 +95,12 @@ class TestViewsDelegate : public views::ViewsDelegate {
}
#endif
+ content::WebContents* CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) OVERRIDE {
+ return NULL;
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate);
};
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 41d7cbd..44fb363 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -845,8 +845,6 @@
'browser/chromeos/ui/brightness_bubble.h',
'browser/chromeos/ui/idle_logout_dialog_view.cc',
'browser/chromeos/ui/idle_logout_dialog_view.h',
- 'browser/chromeos/ui/screensaver_extension_dialog.cc',
- 'browser/chromeos/ui/screensaver_extension_dialog.h',
'browser/chromeos/ui/setting_level_bubble.cc',
'browser/chromeos/ui/setting_level_bubble.h',
'browser/chromeos/ui/setting_level_bubble_view.cc',