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

Side by Side Diff: chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc

Issue 11419013: Add desktop vs. ash context to ui_controls Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac typo Created 8 years, 1 month 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
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 "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() {}
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 private:
oshima 2012/11/16 20:41:39 nit: new line before private:
scottmg 2012/11/16 22:34:06 Done.
51 DISALLOW_COPY_AND_ASSIGN(UIControlsTypeDelegateWin);
52 };
38 #endif 53 #endif
39 54
40 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() { 55 ChromeBrowserMainExtraPartsAsh::ChromeBrowserMainExtraPartsAsh() {
41 } 56 }
42 57
43 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { 58 ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {
44 } 59 }
45 60
46 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { 61 void ChromeBrowserMainExtraPartsAsh::PreProfileInit() {
47 if (chrome::ShouldOpenAshOnStartup()) { 62 if (chrome::ShouldOpenAshOnStartup()) {
48 chrome::OpenAsh(); 63 chrome::OpenAsh();
49 if (CommandLine::ForCurrentProcess()->HasSwitch( 64 if (CommandLine::ForCurrentProcess()->HasSwitch(
50 switches::kAshEnableTabScrubbing)) { 65 switches::kAshEnableTabScrubbing)) {
51 TabScrubber::GetInstance(); 66 TabScrubber::GetInstance();
52 } 67 }
53 } else { 68 } else {
54 #if !defined(OS_CHROMEOS) 69 #if !defined(OS_CHROMEOS)
55 gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin); 70 gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin);
71 ui_controls::UIControls::SetUIControlsTypeDelegate(
72 new UIControlsTypeDelegateWin);
56 #endif 73 #endif
57 } 74 }
58 75
59 #if defined(FILE_MANAGER_EXTENSION) 76 #if defined(FILE_MANAGER_EXTENSION)
60 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory); 77 ui::SelectFileDialog::SetFactory(new SelectFileDialogExtensionFactory);
61 #endif 78 #endif
62 } 79 }
63 80
64 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() { 81 void ChromeBrowserMainExtraPartsAsh::PostProfileInit() {
65 } 82 }
66 83
67 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() { 84 void ChromeBrowserMainExtraPartsAsh::PostMainMessageLoopRun() {
68 chrome::CloseAsh(); 85 chrome::CloseAsh();
69 } 86 }
70 87
71 namespace chrome { 88 namespace chrome {
72 89
73 void AddAshToolkitExtraParts(ChromeBrowserMainParts* main_parts) { 90 void AddAshToolkitExtraParts(ChromeBrowserMainParts* main_parts) {
74 main_parts->AddParts(new ChromeBrowserMainExtraPartsAsh()); 91 main_parts->AddParts(new ChromeBrowserMainExtraPartsAsh());
75 } 92 }
76 93
77 } // namespace chrome 94 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698