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

Side by Side Diff: athena/main/athena_main.cc

Issue 448063005: Add minimum Conetxt Menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/content/public/content_activity_factory.h" 5 #include "athena/content/public/content_activity_factory.h"
6 #include "athena/content/public/content_app_model_builder.h" 6 #include "athena/content/public/content_app_model_builder.h"
7 #include "athena/content/public/web_contents_view_delegate_creator.h"
7 #include "athena/home/public/home_card.h" 8 #include "athena/home/public/home_card.h"
8 #include "athena/main/athena_app_window_controller.h" 9 #include "athena/main/athena_app_window_controller.h"
9 #include "athena/main/athena_launcher.h" 10 #include "athena/main/athena_launcher.h"
10 #include "athena/main/debug/debug_window.h" 11 #include "athena/main/debug/debug_window.h"
11 #include "athena/main/placeholder.h" 12 #include "athena/main/placeholder.h"
12 #include "athena/main/url_search_provider.h" 13 #include "athena/main/url_search_provider.h"
13 #include "athena/screen/public/screen_manager.h" 14 #include "athena/screen/public/screen_manager.h"
14 #include "athena/virtual_keyboard/public/virtual_keyboard_manager.h" 15 #include "athena/virtual_keyboard/public/virtual_keyboard_manager.h"
15 #include "base/command_line.h" 16 #include "base/command_line.h"
16 #include "base/file_util.h" 17 #include "base/file_util.h"
17 #include "base/path_service.h" 18 #include "base/path_service.h"
18 #include "content/public/app/content_main.h" 19 #include "content/public/app/content_main.h"
19 #include "extensions/shell/app/shell_main_delegate.h" 20 #include "extensions/shell/app/shell_main_delegate.h"
20 #include "extensions/shell/browser/shell_browser_main_delegate.h" 21 #include "extensions/shell/browser/shell_browser_main_delegate.h"
21 #include "extensions/shell/browser/shell_content_browser_client.h" 22 #include "extensions/shell/browser/shell_content_browser_client.h"
22 #include "extensions/shell/browser/shell_desktop_controller.h" 23 #include "extensions/shell/browser/shell_desktop_controller.h"
23 #include "extensions/shell/browser/shell_extension_system.h" 24 #include "extensions/shell/browser/shell_extension_system.h"
24 #include "extensions/shell/common/switches.h" 25 #include "extensions/shell/common/switches.h"
25 #include "extensions/shell/renderer/shell_renderer_main_delegate.h" 26 #include "extensions/shell/renderer/shell_renderer_main_delegate.h"
26 #include "ui/app_list/app_list_switches.h" 27 #include "ui/app_list/app_list_switches.h"
27 #include "ui/aura/window_tree_host.h" 28 #include "ui/aura/window_tree_host.h"
28 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
29 #include "ui/keyboard/keyboard_controller.h" 30 #include "ui/keyboard/keyboard_controller.h"
30 #include "ui/keyboard/keyboard_controller_observer.h" 31 #include "ui/keyboard/keyboard_controller_observer.h"
31 #include "ui/native_theme/native_theme_switches.h" 32 #include "ui/native_theme/native_theme_switches.h"
32 #include "ui/wm/core/visibility_controller.h" 33 #include "ui/wm/core/visibility_controller.h"
34 #include "ui/wm/core/wm_state.h"
33 35
34 namespace { 36 namespace {
35 37
36 // We want to load the sample calculator app by default, for a while. Expecting 38 // We want to load the sample calculator app by default, for a while. Expecting
37 // to run athena_main at src/ 39 // to run athena_main at src/
38 const char kDefaultAppPath[] = 40 const char kDefaultAppPath[] =
39 "chrome/common/extensions/docs/examples/apps/calculator/app"; 41 "chrome/common/extensions/docs/examples/apps/calculator/app";
40 } // namespace 42 } // namespace
41 43
42 // This class observes the change of the virtual keyboard and distribute the 44 // This class observes the change of the virtual keyboard and distribute the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController); 76 DISALLOW_COPY_AND_ASSIGN(AthenaDesktopController);
75 }; 77 };
76 78
77 class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate { 79 class AthenaBrowserMainDelegate : public extensions::ShellBrowserMainDelegate {
78 public: 80 public:
79 AthenaBrowserMainDelegate() {} 81 AthenaBrowserMainDelegate() {}
80 virtual ~AthenaBrowserMainDelegate() {} 82 virtual ~AthenaBrowserMainDelegate() {}
81 83
82 // extensions::ShellBrowserMainDelegate: 84 // extensions::ShellBrowserMainDelegate:
83 virtual void Start(content::BrowserContext* context) OVERRIDE { 85 virtual void Start(content::BrowserContext* context) OVERRIDE {
86 wm_state_.reset(new ::wm::WMState);
Jun Mukai 2014/08/07 19:30:59 I think sadrul has added WMSate to window manager.
oshima 2014/08/07 20:23:07 I didn't exist when I worked on it. thanks you for
87
84 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 88 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
85 89
86 // Force showing in the experimental app-list view. 90 // Force showing in the experimental app-list view.
87 command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList); 91 command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList);
88 command_line->AppendSwitch(switches::kEnableOverlayScrollbar); 92 command_line->AppendSwitch(switches::kEnableOverlayScrollbar);
89 93
90 base::FilePath app_dir = base::FilePath::FromUTF8Unsafe( 94 base::FilePath app_dir = base::FilePath::FromUTF8Unsafe(
91 command_line->HasSwitch(extensions::switches::kAppShellAppPath) 95 command_line->HasSwitch(extensions::switches::kAppShellAppPath)
92 ? command_line->GetSwitchValueNative( 96 ? command_line->GetSwitchValueNative(
93 extensions::switches::kAppShellAppPath) 97 extensions::switches::kAppShellAppPath)
(...skipping 16 matching lines...) Expand all
110 athena::VirtualKeyboardManager::Create(context); 114 athena::VirtualKeyboardManager::Create(context);
111 keyboard_observer_.reset(new VirtualKeyboardObserver()); 115 keyboard_observer_.reset(new VirtualKeyboardObserver());
112 116
113 CreateTestPages(context); 117 CreateTestPages(context);
114 CreateDebugWindow(); 118 CreateDebugWindow();
115 } 119 }
116 120
117 virtual void Shutdown() OVERRIDE { 121 virtual void Shutdown() OVERRIDE {
118 keyboard_observer_.reset(); 122 keyboard_observer_.reset();
119 athena::ShutdownAthena(); 123 athena::ShutdownAthena();
124 wm_state_.reset();
120 } 125 }
121 126
122 virtual extensions::ShellDesktopController* CreateDesktopController() 127 virtual extensions::ShellDesktopController* CreateDesktopController()
123 OVERRIDE { 128 OVERRIDE {
124 // TODO(mukai): create Athena's own ShellDesktopController subclass so that 129 // TODO(mukai): create Athena's own ShellDesktopController subclass so that
125 // it can initialize its own window manager logic. 130 // it can initialize its own window manager logic.
126 extensions::ShellDesktopController* desktop = new AthenaDesktopController(); 131 extensions::ShellDesktopController* desktop = new AthenaDesktopController();
127 desktop->SetAppWindowController(new athena::AthenaAppWindowController()); 132 desktop->SetAppWindowController(new athena::AthenaAppWindowController());
128 return desktop; 133 return desktop;
129 } 134 }
130 135
131 private: 136 private:
137 scoped_ptr< ::wm::WMState> wm_state_;
138
132 scoped_ptr<VirtualKeyboardObserver> keyboard_observer_; 139 scoped_ptr<VirtualKeyboardObserver> keyboard_observer_;
133 140
134 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate); 141 DISALLOW_COPY_AND_ASSIGN(AthenaBrowserMainDelegate);
135 }; 142 };
136 143
137 class AthenaContentBrowserClient 144 class AthenaContentBrowserClient
138 : public extensions::ShellContentBrowserClient { 145 : public extensions::ShellContentBrowserClient {
139 public: 146 public:
140 AthenaContentBrowserClient() 147 AthenaContentBrowserClient()
141 : extensions::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) { 148 : extensions::ShellContentBrowserClient(new AthenaBrowserMainDelegate()) {
142 } 149 }
143 virtual ~AthenaContentBrowserClient() {} 150 virtual ~AthenaContentBrowserClient() {}
144 151
145 // content::ContentBrowserClient: 152 // content::ContentBrowserClient:
146 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( 153 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate(
147 content::WebContents* web_contents) OVERRIDE { 154 content::WebContents* web_contents) OVERRIDE {
148 // TODO(oshima): Implement athena's WebContentsViewDelegate. 155 return athena::CreateWebContentsViewDelegate(web_contents);
149 return NULL;
150 } 156 }
151 157
152 private: 158 private:
153 DISALLOW_COPY_AND_ASSIGN(AthenaContentBrowserClient); 159 DISALLOW_COPY_AND_ASSIGN(AthenaContentBrowserClient);
154 }; 160 };
155 161
156 class AthenaRendererMainDelegate 162 class AthenaRendererMainDelegate
157 : public extensions::ShellRendererMainDelegate { 163 : public extensions::ShellRendererMainDelegate {
158 public: 164 public:
159 AthenaRendererMainDelegate() {} 165 AthenaRendererMainDelegate() {}
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 206
201 int main(int argc, const char** argv) { 207 int main(int argc, const char** argv) {
202 AthenaMainDelegate delegate; 208 AthenaMainDelegate delegate;
203 content::ContentMainParams params(&delegate); 209 content::ContentMainParams params(&delegate);
204 210
205 params.argc = argc; 211 params.argc = argc;
206 params.argv = argv; 212 params.argv = argv;
207 213
208 return content::ContentMain(params); 214 return content::ContentMain(params);
209 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698