This source file includes following definitions.
- GetScreenTypeForNativeView
- IsWindowInMetro
- PreProfileInit
- PostProfileInit
- PostMainMessageLoopRun
#include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h"
#include "ash/root_window_controller.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "chrome/browser/chrome_browser_main.h"
#include "chrome/browser/ui/ash/ash_init.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/browser/ui/views/ash/tab_scrubber.h"
#include "chrome/common/chrome_switches.h"
#include "ui/aura/env.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/screen_type_delegate.h"
#include "ui/keyboard/keyboard.h"
#include "ui/keyboard/keyboard_util.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/ui/views/select_file_dialog_extension.h"
#include "chrome/browser/ui/views/select_file_dialog_extension_factory.h"
#endif
#if !defined(OS_CHROMEOS)
#include "ui/shell_dialogs/select_file_dialog.h"
#include "ui/shell_dialogs/shell_dialogs_delegate.h"
#endif
#if !defined(OS_CHROMEOS)
class ScreenTypeDelegateWin : public gfx::ScreenTypeDelegate {
public:
ScreenTypeDelegateWin() {}
virtual gfx::ScreenType GetScreenTypeForNativeView(
gfx::NativeView view) OVERRIDE {
return chrome::IsNativeViewInAsh(view) ?
gfx::SCREEN_TYPE_ALTERNATE :
gfx::SCREEN_TYPE_NATIVE;
}
private:
DISALLOW_COPY_AND_ASSIGN(ScreenTypeDelegateWin);
};
class ShellDialogsDelegateWin : public ui::ShellDialogsDelegate {
public:
ShellDialogsDelegateWin() {}
virtual bool IsWindowInMetro(gfx::NativeWindow window) OVERRIDE {
return chrome::IsNativeViewInAsh(window);
}
private:
DISALLOW_COPY_AND_ASSIGN(ShellDialogsDelegateWin);
};
base::LazyInstance<ShellDialogsDelegateWin> g_shell_dialogs_delegate;
#endif
ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {
}
ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {
}
void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
if (chrome::ShouldOpenAshOnStartup()) {
chrome::OpenAsh();
} else {
#if !defined(OS_CHROMEOS)
gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin);
ui::SelectFileDialog::SetShellDialogsDelegate(
g_shell_dialogs_delegate.Pointer());
#endif
}
#if defined(OS_CHROMEOS)
keyboard::InitializeKeyboard();
#endif
#if defined(OS_CHROMEOS)
ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory);
#endif
}
void ChromeBrowserMainExtraPartsAsh::PostProfileInit() {
if (!ash::Shell::HasInstance())
return;
TabScrubber::GetInstance();
if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) {
ash::Shell::GetPrimaryRootWindowController()->ActivateKeyboard(
ash::Shell::GetInstance()->keyboard_controller());
}
}
void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() {
chrome::CloseAsh();
}