Chromium Code Reviews| 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 "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" | 5 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chrome_browser_main.h" | 8 #include "chrome/browser/chrome_browser_main.h" |
| 9 #include "chrome/browser/toolkit_extra_parts.h" | 9 #include "chrome/browser/toolkit_extra_parts.h" |
| 10 #include "chrome/browser/ui/ash/ash_init.h" | 10 #include "chrome/browser/ui/ash/ash_init.h" |
| 11 #include "chrome/browser/ui/ash/ash_util.h" | 11 #include "chrome/browser/ui/ash/ash_util.h" |
| 12 #include "chrome/browser/ui/views/ash/tab_scrubber.h" | 12 #include "chrome/browser/ui/views/ash/tab_scrubber.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
| 15 #include "ui/gfx/screen.h" | 15 #include "ui/gfx/screen.h" |
| 16 #include "ui/gfx/screen_type_delegate.h" | 16 #include "ui/gfx/screen_type_delegate.h" |
| 17 #include "ui/ui_controls/ui_controls.h" | |
| 18 #include "ui/ui_controls/ui_controls_type_delegate.h" | |
| 17 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 19 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 18 #include "ui/views/widget/desktop_aura/desktop_stacking_client.h" | 20 #include "ui/views/widget/desktop_aura/desktop_stacking_client.h" |
| 19 | 21 |
| 20 #if defined(FILE_MANAGER_EXTENSION) | 22 #if defined(FILE_MANAGER_EXTENSION) |
| 21 #include "chrome/browser/ui/views/select_file_dialog_extension.h" | 23 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
| 22 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h" | 24 #include "chrome/browser/ui/views/select_file_dialog_extension_factory.h" |
| 23 #endif | 25 #endif |
| 24 | 26 |
| 25 #if !defined(OS_CHROMEOS) | 27 #if !defined(OS_CHROMEOS) |
| 26 class ScreenTypeDelegateWin : public gfx::ScreenTypeDelegate { | 28 class ScreenTypeDelegateWin : public gfx::ScreenTypeDelegate { |
| 27 public: | 29 public: |
| 28 ScreenTypeDelegateWin() {} | 30 ScreenTypeDelegateWin() {} |
| 29 virtual gfx::ScreenType GetScreenTypeForNativeView( | 31 virtual gfx::ScreenType GetScreenTypeForNativeView( |
| 30 gfx::NativeView view) OVERRIDE { | 32 gfx::NativeView view) OVERRIDE { |
| 31 return chrome::IsNativeViewInAsh(view) ? | 33 return chrome::IsNativeViewInAsh(view) ? |
| 32 gfx::SCREEN_TYPE_ALTERNATE : | 34 gfx::SCREEN_TYPE_ALTERNATE : |
| 33 gfx::SCREEN_TYPE_NATIVE; | 35 gfx::SCREEN_TYPE_NATIVE; |
| 34 } | 36 } |
| 35 private: | 37 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(ScreenTypeDelegateWin); | 38 DISALLOW_COPY_AND_ASSIGN(ScreenTypeDelegateWin); |
| 37 }; | 39 }; |
| 40 | |
| 41 class UIControlsTypeDelegateWin : public ui_controls::UIControlsTypeDelegate { | |
| 42 public: | |
| 43 UIControlsTypeDelegateWin() {} | |
|
oshima
2012/11/16 23:04:07
virtual dtor
scottmg
2012/11/16 23:10:29
Done.
| |
| 44 virtual ui_controls::UIControlsType GetUIControlsTypeForNativeView( | |
| 45 gfx::NativeView view) OVERRIDE { | |
| 46 return chrome::IsNativeViewInAsh(view) ? | |
| 47 ui_controls::UI_CONTROLS_TYPE_ALTERNATE : | |
| 48 ui_controls::UI_CONTROLS_TYPE_NATIVE; | |
| 49 } | |
| 50 | |
| 51 private: | |
| 52 DISALLOW_COPY_AND_ASSIGN(UIControlsTypeDelegateWin); | |
| 53 }; | |
| 38 #endif | 54 #endif |
| 39 | 55 |
| 40 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() { | 56 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() { |
| 41 } | 57 } |
| 42 | 58 |
| 43 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { | 59 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { |
| 44 } | 60 } |
| 45 | 61 |
| 46 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { | 62 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { |
| 47 if (chrome::ShouldOpenAshOnStartup()) { | 63 if (chrome::ShouldOpenAshOnStartup()) { |
| 48 chrome::OpenAsh(); | 64 chrome::OpenAsh(); |
| 49 if (CommandLine::ForCurrentProcess()->HasSwitch( | 65 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 50 switches::kAshEnableTabScrubbing)) { | 66 switches::kAshEnableTabScrubbing)) { |
| 51 TabScrubber::GetInstance(); | 67 TabScrubber::GetInstance(); |
| 52 } | 68 } |
| 53 } else { | 69 } else { |
| 54 #if !defined(OS_CHROMEOS) | 70 #if !defined(OS_CHROMEOS) |
| 55 gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin); | 71 gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin); |
| 72 ui_controls::UIControls::SetUIControlsTypeDelegate( | |
| 73 new UIControlsTypeDelegateWin); | |
| 56 #endif | 74 #endif |
| 57 } | 75 } |
| 58 | 76 |
| 59 #if defined(FILE_MANAGER_EXTENSION) | 77 #if defined(FILE_MANAGER_EXTENSION) |
| 60 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); | 78 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); |
| 61 #endif | 79 #endif |
| 62 } | 80 } |
| 63 | 81 |
| 64 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { | 82 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { |
| 65 } | 83 } |
| 66 | 84 |
| 67 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { | 85 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { |
| 68 chrome::CloseAsh(); | 86 chrome::CloseAsh(); |
| 69 } | 87 } |
| 70 | 88 |
| 71 namespace chrome { | 89 namespace chrome { |
| 72 | 90 |
| 73 void AddAshToolkitExtraParts(ChromeBrowserMainParts* main_parts) { | 91 void AddAshToolkitExtraParts(ChromeBrowserMainParts* main_parts) { |
| 74 main_parts->AddParts(new ChromeBrowserMainExtraPartsAsh()); | 92 main_parts->AddParts(new ChromeBrowserMainExtraPartsAsh()); |
| 75 } | 93 } |
| 76 | 94 |
| 77 } // namespace chrome | 95 } // namespace chrome |
| OLD | NEW |