diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 21:32:48 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-12 21:32:48 +0000 |
commit | fa4a458315fa15f2077a63ce3f5578bc499655be (patch) | |
tree | e208c18768533bf3260cd8c03d916953e5e7dce0 | |
parent | d78e2b28e27bafe18efbfd2caeac68fbf7ef0f75 (diff) | |
download | chromium_src-fa4a458315fa15f2077a63ce3f5578bc499655be.zip chromium_src-fa4a458315fa15f2077a63ce3f5578bc499655be.tar.gz chromium_src-fa4a458315fa15f2077a63ce3f5578bc499655be.tar.bz2 |
Support WebView in ash.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10054038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132063 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/ash.gyp | 19 | ||||
-rw-r--r-- | ash/shell.h | 12 | ||||
-rw-r--r-- | ash/shell/DEPS | 4 | ||||
-rw-r--r-- | ash/shell/app_list.cc | 3 | ||||
-rw-r--r-- | ash/shell/content_client/DEPS | 3 | ||||
-rw-r--r-- | ash/shell/content_client/shell_browser_main_parts.cc | 120 | ||||
-rw-r--r-- | ash/shell/content_client/shell_browser_main_parts.h | 77 | ||||
-rw-r--r-- | ash/shell/content_client/shell_content_browser_client.cc | 373 | ||||
-rw-r--r-- | ash/shell/content_client/shell_content_browser_client.h | 210 | ||||
-rw-r--r-- | ash/shell/content_client/shell_main_delegate.cc | 108 | ||||
-rw-r--r-- | ash/shell/content_client/shell_main_delegate.h | 64 | ||||
-rw-r--r-- | ash/shell/shell_main.cc | 118 | ||||
-rw-r--r-- | ash/shell/window_type_launcher.cc | 5 | ||||
-rw-r--r-- | content/content_shell.gypi | 7 | ||||
-rw-r--r-- | content/shell/shell.cc | 2 | ||||
-rw-r--r-- | content/shell/shell.h | 12 | ||||
-rw-r--r-- | content/shell/shell_aura.cc | 44 | ||||
-rw-r--r-- | content/shell/shell_download_manager_delegate.cc | 2 | ||||
-rw-r--r-- | ui/views/examples/examples_main.cc | 1 |
19 files changed, 1075 insertions, 109 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index c88621a..d97d325 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -421,6 +421,8 @@ '../base/base.gyp:base', '../base/base.gyp:base_i18n', '../chrome/chrome_resources.gyp:packed_resources', + '../content/content.gyp:content_shell_lib', + '../content/content.gyp:content', '../skia/skia.gyp:skia', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', @@ -438,6 +440,12 @@ 'sources': [ 'shell/app_list.cc', 'shell/bubble.cc', + 'shell/content_client/shell_browser_main_parts.cc', + 'shell/content_client/shell_browser_main_parts.h', + 'shell/content_client/shell_content_browser_client.cc', + 'shell/content_client/shell_content_browser_client.h', + 'shell/content_client/shell_main_delegate.cc', + 'shell/content_client/shell_main_delegate.h', 'shell/example_factory.h', 'shell/launcher_delegate_impl.cc', 'shell/launcher_delegate_impl.h', @@ -460,9 +468,20 @@ '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.rc', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc', + '../content/app/startup_helper_win.cc', '../ui/views/test/test_views_delegate.cc', ], 'conditions': [ + ['OS=="win"', { + 'msvs_settings': { + 'VCLinkerTool': { + 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS + }, + }, + 'dependencies': [ + '../sandbox/sandbox.gyp:sandbox', + ], + }], ['OS=="mac"', { 'product_name': 'AuraShell', 'mac_bundle': 1, diff --git a/ash/shell.h b/ash/shell.h index 35632a5..690ae79 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -28,6 +28,10 @@ class Monitor; class RootWindow; class Window; } +namespace content { +class BrowserContext; +} + namespace gfx { class Point; class Rect; @@ -251,6 +255,11 @@ class ASH_EXPORT Shell { return shadow_controller_.get(); } + content::BrowserContext* browser_context() { return browser_context_; } + void set_browser_context(content::BrowserContext* browser_context) { + browser_context_ = browser_context; + } + private: FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, MouseEventCursors); FRIEND_TEST_ALL_PREFIXES(RootWindowEventFilterTest, TransformActivate); @@ -348,6 +357,9 @@ class ASH_EXPORT Shell { // |status_widget_|). scoped_ptr<SystemTray> tray_; + // Used by ash/shell. + content::BrowserContext* browser_context_; + DISALLOW_COPY_AND_ASSIGN(Shell); }; diff --git a/ash/shell/DEPS b/ash/shell/DEPS new file mode 100644 index 0000000..24f7ff1 --- /dev/null +++ b/ash/shell/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + "+content", + "+sandbox", +] diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index 19f4336..2e4fd77 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -92,7 +92,8 @@ class WindowTypeLauncherItem : public ash::AppListItemModel { case EXAMPLES_WINDOW: { #if !defined(OS_MACOSX) views::examples::ShowExamplesWindow( - views::examples::DO_NOTHING_ON_CLOSE, NULL); + views::examples::DO_NOTHING_ON_CLOSE, + ash::Shell::GetInstance()->browser_context()); #endif break; } diff --git a/ash/shell/content_client/DEPS b/ash/shell/content_client/DEPS new file mode 100644 index 0000000..60dbcf4 --- /dev/null +++ b/ash/shell/content_client/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+content", +] diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc new file mode 100644 index 0000000..2aaaed2 --- /dev/null +++ b/ash/shell/content_client/shell_browser_main_parts.cc @@ -0,0 +1,120 @@ +// 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 "ash/shell/content_client/shell_browser_main_parts.h" + +#include "ash/shell/shell_delegate_impl.h" +#include "ash/shell/window_watcher.h" +#include "base/bind.h" +#include "base/command_line.h" +#include "base/i18n/icu_util.h" +#include "base/message_loop.h" +#include "base/string_number_conversions.h" +#include "base/threading/thread.h" +#include "base/threading/thread_restrictions.h" +#include "content/public/common/content_switches.h" +#include "content/shell/shell.h" +#include "content/shell/shell_browser_context.h" +#include "content/shell/shell_devtools_delegate.h" +#include "content/shell/shell_switches.h" +#include "googleurl/src/gurl.h" +#include "net/base/net_module.h" +#include "ui/aura/client/stacking_client.h" +#include "ui/aura/env.h" +#include "ui/aura/root_window.h" +#include "ui/aura/window.h" +#include "ui/base/clipboard/clipboard.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" +#include "ui/gfx/compositor/compositor.h" +#include "ui/gfx/compositor/test/compositor_test_support.h" +#include "ui/views/test/test_views_delegate.h" +#include "ui/views/focus/accelerator_handler.h" + +namespace ash { +namespace shell { +void InitWindowTypeLauncher(); + +namespace { +class ShellViewsDelegate : public views::TestViewsDelegate { + public: + ShellViewsDelegate() {} + virtual ~ShellViewsDelegate() {} + + // Overridden from views::TestViewsDelegate: + virtual views::NonClientFrameView* CreateDefaultNonClientFrameView( + views::Widget* widget) OVERRIDE { + return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget); + } + bool UseTransparentWindows() const OVERRIDE { + // Ash uses transparent window frames. + return true; + } + + private: + DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate); +}; + +} // namespace + +ShellBrowserMainParts::ShellBrowserMainParts( + const content::MainFunctionParams& parameters) + : BrowserMainParts(), + devtools_delegate_(NULL) { +} + +ShellBrowserMainParts::~ShellBrowserMainParts() { +} + +#if !defined(OS_MACOSX) +void ShellBrowserMainParts::PreMainMessageLoopStart() { +} +#endif + +int ShellBrowserMainParts::PreCreateThreads() { + return 0; +} + +void ShellBrowserMainParts::PreMainMessageLoopRun() { + browser_context_.reset(new content::ShellBrowserContext); + + // A ViewsDelegate is required. + if (!views::ViewsDelegate::views_delegate) + views::ViewsDelegate::views_delegate = new ShellViewsDelegate; + + ash::shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl; + ash::Shell::CreateInstance(delegate); + ash::Shell::GetInstance()->set_browser_context(browser_context_.get()); + + window_watcher_.reset(new ash::shell::WindowWatcher); + delegate->SetWatcher(window_watcher_.get()); + + ash::shell::InitWindowTypeLauncher(); + + ash::Shell::GetRootWindow()->ShowRootWindow(); +} + +void ShellBrowserMainParts::PostMainMessageLoopRun() { + if (devtools_delegate_) + devtools_delegate_->Stop(); + browser_context_.reset(); + + window_watcher_.reset(); + ash::Shell::DeleteInstance(); + aura::Env::DeleteInstance(); +} + +bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { + MessageLoopForUI::current()->Run(); + return true; +} + +ui::Clipboard* ShellBrowserMainParts::GetClipboard() { + if (!clipboard_.get()) + clipboard_.reset(new ui::Clipboard()); + return clipboard_.get(); +} + +} // namespace shell +} // namespace ash diff --git a/ash/shell/content_client/shell_browser_main_parts.h b/ash/shell/content_client/shell_browser_main_parts.h new file mode 100644 index 0000000..7a0496b --- /dev/null +++ b/ash/shell/content_client/shell_browser_main_parts.h @@ -0,0 +1,77 @@ +// 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 ASH_SHELL_CONTENT_CLIENT_EXAMPLES_BROWSER_MAIN_PARTS_H_ +#define ASH_SHELL_CONTENT_CLIENT_EXAMPLES_BROWSER_MAIN_PARTS_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/browser_main_parts.h" + +namespace base { +class Thread; +} + +namespace ui { +class Clipboard; +} + +namespace content { +class ShellBrowserContext; +class ShellDevToolsDelegate; +struct MainFunctionParams; +} + +namespace views { +class ViewsDelegate; +} + +namespace ash { +namespace shell { + +class WindowWatcher; + +class ShellBrowserMainParts : public content::BrowserMainParts { + public: + explicit ShellBrowserMainParts( + const content::MainFunctionParams& parameters); + virtual ~ShellBrowserMainParts(); + + // Overridden from content::BrowserMainParts: + virtual void PreEarlyInitialization() OVERRIDE {} + virtual void PostEarlyInitialization() OVERRIDE {} + virtual void PreMainMessageLoopStart() OVERRIDE; + virtual void PostMainMessageLoopStart() OVERRIDE {} + virtual void ToolkitInitialized() OVERRIDE {} + virtual int PreCreateThreads() OVERRIDE; + virtual void PreMainMessageLoopRun() OVERRIDE; + virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; + virtual void PostMainMessageLoopRun() OVERRIDE; + virtual void PostDestroyThreads() OVERRIDE {} + + ui::Clipboard* GetClipboard(); + content::ShellDevToolsDelegate* devtools_delegate() { + return devtools_delegate_; + } + + content::ShellBrowserContext* browser_context() { + return browser_context_.get(); + } + + private: + scoped_ptr<content::ShellBrowserContext> browser_context_; + + scoped_ptr<ui::Clipboard> clipboard_; + content::ShellDevToolsDelegate* devtools_delegate_; + scoped_ptr<views::ViewsDelegate> views_delegate_; + scoped_ptr<ash::shell::WindowWatcher> window_watcher_; + + DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); +}; + +} // namespace shell +} // namespace ash + +#endif // ASH_SHELL_CONTENT_CLIENT_EXAMPLES_BROWSER_MAIN_PARTS_H_ diff --git a/ash/shell/content_client/shell_content_browser_client.cc b/ash/shell/content_client/shell_content_browser_client.cc new file mode 100644 index 0000000..bae0eb5 --- /dev/null +++ b/ash/shell/content_client/shell_content_browser_client.cc @@ -0,0 +1,373 @@ +// 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 "ash/shell/content_client/shell_content_browser_client.h" + +#include "ash/shell/content_client/shell_browser_main_parts.h" +#include "base/command_line.h" +#include "base/file_path.h" +#include "content/public/browser/resource_dispatcher_host.h" +#include "content/shell/shell.h" +#include "content/shell/shell_devtools_delegate.h" +#include "content/shell/shell_render_view_host_observer.h" +#include "content/shell/shell_resource_dispatcher_host_delegate.h" +#include "content/shell/shell_switches.h" +#include "googleurl/src/gurl.h" +#include "third_party/skia/include/core/SkBitmap.h" + +namespace ash { +namespace shell { + +ShellContentBrowserClient::ShellContentBrowserClient() + : shell_browser_main_parts_(NULL) { +} + +ShellContentBrowserClient::~ShellContentBrowserClient() { +} + +content::BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( + const content::MainFunctionParams& parameters) { + shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); + return shell_browser_main_parts_; +} + +content::WebContentsView* + ShellContentBrowserClient::OverrideCreateWebContentsView( + content::WebContents* web_contents) { + return NULL; +} + +content::WebContentsViewDelegate* + ShellContentBrowserClient::GetWebContentsViewDelegate( + content::WebContents* web_contents) { + return NULL; +} + +void ShellContentBrowserClient::RenderViewHostCreated( + content::RenderViewHost* render_view_host) { + new content::ShellRenderViewHostObserver(render_view_host); +} + +void ShellContentBrowserClient::RenderProcessHostCreated( + content::RenderProcessHost* host) { +} + +content::WebUIControllerFactory* + ShellContentBrowserClient::GetWebUIControllerFactory() { + return NULL; +} + +GURL ShellContentBrowserClient::GetEffectiveURL( + content::BrowserContext* browser_context, const GURL& url) { + return GURL(); +} + +bool ShellContentBrowserClient::ShouldUseProcessPerSite( + content::BrowserContext* browser_context, const GURL& effective_url) { + return false; +} + +bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { + return false; +} + +bool ShellContentBrowserClient::IsSuitableHost( + content::RenderProcessHost* process_host, + const GURL& site_url) { + return true; +} + +bool ShellContentBrowserClient::ShouldTryToUseExistingProcessHost( + content::BrowserContext* browser_context, const GURL& url) { + return false; +} + +void ShellContentBrowserClient::SiteInstanceGotProcess( + content::SiteInstance* site_instance) { +} + +void ShellContentBrowserClient::SiteInstanceDeleting( + content::SiteInstance* site_instance) { +} + +bool ShellContentBrowserClient::ShouldSwapProcessesForNavigation( + const GURL& current_url, + const GURL& new_url) { + return false; +} + +std::string ShellContentBrowserClient::GetCanonicalEncodingNameByAliasName( + const std::string& alias_name) { + return std::string(); +} + +void ShellContentBrowserClient::AppendExtraCommandLineSwitches( + CommandLine* command_line, int child_process_id) { + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) + command_line->AppendSwitch(switches::kDumpRenderTree); +} + +std::string ShellContentBrowserClient::GetApplicationLocale() { + return std::string(); +} + +std::string ShellContentBrowserClient::GetAcceptLangs( + content::BrowserContext* context) { + return std::string(); +} + +SkBitmap* ShellContentBrowserClient::GetDefaultFavicon() { + static SkBitmap empty; + return ∅ +} + +bool ShellContentBrowserClient::AllowAppCache( + const GURL& manifest_url, + const GURL& first_party, + content::ResourceContext* context) { + return true; +} + +bool ShellContentBrowserClient::AllowGetCookie( + const GURL& url, + const GURL& first_party, + const net::CookieList& cookie_list, + content::ResourceContext* context, + int render_process_id, + int render_view_id) { + return true; +} + +bool ShellContentBrowserClient::AllowSetCookie( + const GURL& url, + const GURL& first_party, + const std::string& cookie_line, + content::ResourceContext* context, + int render_process_id, + int render_view_id, + net::CookieOptions* options) { + return true; +} + +bool ShellContentBrowserClient::AllowSaveLocalState( + content::ResourceContext* context) { + return true; +} + +bool ShellContentBrowserClient::AllowWorkerDatabase( + const GURL& url, + const string16& name, + const string16& display_name, + unsigned long estimated_size, + content::ResourceContext* context, + const std::vector<std::pair<int, int> >& render_views) { + return true; +} + +bool ShellContentBrowserClient::AllowWorkerFileSystem( + const GURL& url, + content::ResourceContext* context, + const std::vector<std::pair<int, int> >& render_views) { + return true; +} + +bool ShellContentBrowserClient::AllowWorkerIndexedDB( + const GURL& url, + const string16& name, + content::ResourceContext* context, + const std::vector<std::pair<int, int> >& render_views) { + return true; +} + +content::QuotaPermissionContext* + ShellContentBrowserClient::CreateQuotaPermissionContext() { + return NULL; +} + +net::URLRequestContext* + ShellContentBrowserClient::OverrideRequestContextForURL( + const GURL& url, content::ResourceContext* context) { + return NULL; +} + +void ShellContentBrowserClient::OpenItem(const FilePath& path) { +} + +void ShellContentBrowserClient::ShowItemInFolder(const FilePath& path) { +} + +void ShellContentBrowserClient::AllowCertificateError( + int render_process_id, + int render_view_id, + int cert_error, + const net::SSLInfo& ssl_info, + const GURL& request_url, + bool overridable, + const base::Callback<void(bool)>& callback, + bool* cancel_request) { +} + +void ShellContentBrowserClient::SelectClientCertificate( + int render_process_id, + int render_view_id, + const net::HttpNetworkSession* network_session, + net::SSLCertRequestInfo* cert_request_info, + const base::Callback<void(net::X509Certificate*)>& callback) { +} + +void ShellContentBrowserClient::AddNewCertificate( + net::URLRequest* request, + net::X509Certificate* cert, + int render_process_id, + int render_view_id) { +} + +void ShellContentBrowserClient::RequestMediaAccessPermission( + const content::MediaStreamRequest* request, + const content::MediaResponseCallback& callback) { +} + +content::MediaObserver* ShellContentBrowserClient::GetMediaObserver() { + return NULL; +} + +void ShellContentBrowserClient::RequestDesktopNotificationPermission( + const GURL& source_origin, + int callback_context, + int render_process_id, + int render_view_id) { +} + +WebKit::WebNotificationPresenter::Permission + ShellContentBrowserClient::CheckDesktopNotificationPermission( + const GURL& source_origin, + content::ResourceContext* context, + int render_process_id) { + return WebKit::WebNotificationPresenter::PermissionAllowed; +} + +void ShellContentBrowserClient::ShowDesktopNotification( + const content::ShowDesktopNotificationHostMsgParams& params, + int render_process_id, + int render_view_id, + bool worker) { +} + +void ShellContentBrowserClient::CancelDesktopNotification( + int render_process_id, + int render_view_id, + int notification_id) { +} + +bool ShellContentBrowserClient::CanCreateWindow( + const GURL& opener_url, + const GURL& origin, + WindowContainerType container_type, + content::ResourceContext* context, + int render_process_id, + bool* no_javascript_access) { + *no_javascript_access = false; + return true; +} + +std::string ShellContentBrowserClient::GetWorkerProcessTitle( + const GURL& url, content::ResourceContext* context) { + return std::string(); +} + +void ShellContentBrowserClient::ResourceDispatcherHostCreated() { + resource_dispatcher_host_delegate_.reset( + new content::ShellResourceDispatcherHostDelegate); + content::ResourceDispatcherHost::Get()->SetDelegate( + resource_dispatcher_host_delegate_.get()); +} + +content::SpeechRecognitionManagerDelegate* + ShellContentBrowserClient::GetSpeechRecognitionManagerDelegate() { + return NULL; +} + +ui::Clipboard* ShellContentBrowserClient::GetClipboard() { + return shell_browser_main_parts_->GetClipboard(); +} + +net::NetLog* ShellContentBrowserClient::GetNetLog() { + return NULL; +} + +content::AccessTokenStore* + ShellContentBrowserClient::CreateAccessTokenStore() { + return NULL; +} + +bool ShellContentBrowserClient::IsFastShutdownPossible() { + return true; +} + +void ShellContentBrowserClient::OverrideWebkitPrefs( + content::RenderViewHost* rvh, + const GURL& url, + WebPreferences* prefs) { +} + +void ShellContentBrowserClient::UpdateInspectorSetting( + content::RenderViewHost* rvh, + const std::string& key, + const std::string& value) { +} + +void ShellContentBrowserClient::ClearInspectorSettings( + content::RenderViewHost* rvh) { +} + +void ShellContentBrowserClient::BrowserURLHandlerCreated( + content::BrowserURLHandler* handler) { +} + +void ShellContentBrowserClient::ClearCache(content::RenderViewHost* rvh) { +} + +void ShellContentBrowserClient::ClearCookies(content::RenderViewHost* rvh) { +} + +FilePath ShellContentBrowserClient::GetDefaultDownloadDirectory() { + return FilePath(); +} + +std::string ShellContentBrowserClient::GetDefaultDownloadName() { + return "download"; +} + +bool ShellContentBrowserClient::AllowSocketAPI( + content::BrowserContext* browser_context, + const GURL& url) { + return false; +} + +#if defined(OS_POSIX) && !defined(OS_MACOSX) +int ShellContentBrowserClient::GetCrashSignalFD( + const CommandLine& command_line) { + return -1; +} +#endif + +#if defined(OS_WIN) +const wchar_t* ShellContentBrowserClient::GetResourceDllName() { + return NULL; +} +#endif + +#if defined(USE_NSS) +crypto::CryptoModuleBlockingPasswordDelegate* + ShellContentBrowserClient::GetCryptoPasswordDelegate(const GURL& url) { + return NULL; +} +#endif + +content::ShellBrowserContext* ShellContentBrowserClient::browser_context() { + return shell_browser_main_parts_->browser_context(); +} + +} // namespace examples +} // namespace views diff --git a/ash/shell/content_client/shell_content_browser_client.h b/ash/shell/content_client/shell_content_browser_client.h new file mode 100644 index 0000000..a9e70f8 --- /dev/null +++ b/ash/shell/content_client/shell_content_browser_client.h @@ -0,0 +1,210 @@ +// 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 ASH_SHELL_CONTENT_CLIENT_SHELL_CONTENT_BROWSER_CLIENT_H_ +#define ASH_SHELL_CONTENT_CLIENT_SHELL_CONTENT_BROWSER_CLIENT_H_ +#pragma once + +#include <string> + +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/content_browser_client.h" + +namespace content { +class ShellBrowserContext; +class ShellBrowserMainParts; +class ShellResourceDispatcherHostDelegate; +} + +namespace ash { +namespace shell { + +class ShellBrowserMainParts; + +class ShellContentBrowserClient : public content::ContentBrowserClient { + public: + ShellContentBrowserClient(); + virtual ~ShellContentBrowserClient(); + + // Overridden from content::ContentBrowserClient: + virtual content::BrowserMainParts* CreateBrowserMainParts( + const content::MainFunctionParams& parameters) OVERRIDE; + virtual content::WebContentsView* OverrideCreateWebContentsView( + content::WebContents* web_contents) OVERRIDE; + virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( + content::WebContents* web_contents) OVERRIDE; + virtual void RenderViewHostCreated( + content::RenderViewHost* render_view_host) OVERRIDE; + virtual void RenderProcessHostCreated( + content::RenderProcessHost* host) OVERRIDE; + virtual content::WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE; + virtual GURL GetEffectiveURL(content::BrowserContext* browser_context, + const GURL& url) OVERRIDE; + virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, + const GURL& effective_url) OVERRIDE; + virtual bool IsHandledURL(const GURL& url) OVERRIDE; + virtual bool IsSuitableHost(content::RenderProcessHost* process_host, + const GURL& site_url) OVERRIDE; + virtual bool ShouldTryToUseExistingProcessHost( + content::BrowserContext* browser_context, const GURL& url) OVERRIDE; + virtual void SiteInstanceGotProcess( + content::SiteInstance* site_instance) OVERRIDE; + virtual void SiteInstanceDeleting( + content::SiteInstance* site_instance) OVERRIDE; + virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url, + const GURL& new_url) OVERRIDE; + + virtual std::string GetCanonicalEncodingNameByAliasName( + const std::string& alias_name) OVERRIDE; + virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, + int child_process_id) OVERRIDE; + virtual std::string GetApplicationLocale() OVERRIDE; + virtual std::string GetAcceptLangs( + content::BrowserContext* context) OVERRIDE; + virtual SkBitmap* GetDefaultFavicon() OVERRIDE; + virtual bool AllowAppCache(const GURL& manifest_url, + const GURL& first_party, + content::ResourceContext* context) OVERRIDE; + virtual bool AllowGetCookie(const GURL& url, + const GURL& first_party, + const net::CookieList& cookie_list, + content::ResourceContext* context, + int render_process_id, + int render_view_id) OVERRIDE; + virtual bool AllowSetCookie(const GURL& url, + const GURL& first_party, + const std::string& cookie_line, + content::ResourceContext* context, + int render_process_id, + int render_view_id, + net::CookieOptions* options) OVERRIDE; + virtual bool AllowSaveLocalState( + content::ResourceContext* context) OVERRIDE; + virtual bool AllowWorkerDatabase( + const GURL& url, + const string16& name, + const string16& display_name, + unsigned long estimated_size, + content::ResourceContext* context, + const std::vector<std::pair<int, int> >& render_views) OVERRIDE; + virtual bool AllowWorkerFileSystem( + const GURL& url, + content::ResourceContext* context, + const std::vector<std::pair<int, int> >& render_views) OVERRIDE; + virtual bool AllowWorkerIndexedDB( + const GURL& url, + const string16& name, + content::ResourceContext* context, + const std::vector<std::pair<int, int> >& render_views) OVERRIDE; + virtual net::URLRequestContext* OverrideRequestContextForURL( + const GURL& url, content::ResourceContext* context) OVERRIDE; + virtual content::QuotaPermissionContext* + CreateQuotaPermissionContext() OVERRIDE; + virtual void OpenItem(const FilePath& path) OVERRIDE; + virtual void ShowItemInFolder(const FilePath& path) OVERRIDE; + virtual void AllowCertificateError( + int render_process_id, + int render_view_id, + int cert_error, + const net::SSLInfo& ssl_info, + const GURL& request_url, + bool overridable, + const base::Callback<void(bool)>& callback, + bool* cancel_request) OVERRIDE; + virtual void SelectClientCertificate( + int render_process_id, + int render_view_id, + const net::HttpNetworkSession* network_session, + net::SSLCertRequestInfo* cert_request_info, + const base::Callback<void(net::X509Certificate*)>& callback) OVERRIDE; + virtual void AddNewCertificate( + net::URLRequest* request, + net::X509Certificate* cert, + int render_process_id, + int render_view_id) OVERRIDE; + virtual void RequestMediaAccessPermission( + const content::MediaStreamRequest* request, + const content::MediaResponseCallback& callback) OVERRIDE; + virtual content::MediaObserver* GetMediaObserver() OVERRIDE; + virtual void RequestDesktopNotificationPermission( + const GURL& source_origin, + int callback_context, + int render_process_id, + int render_view_id) OVERRIDE; + virtual WebKit::WebNotificationPresenter::Permission + CheckDesktopNotificationPermission( + const GURL& origin, + content::ResourceContext* context, + int render_process_id) OVERRIDE; + virtual void ShowDesktopNotification( + const content::ShowDesktopNotificationHostMsgParams& params, + int render_process_id, + int render_view_id, + bool worker) OVERRIDE; + virtual void CancelDesktopNotification( + int render_process_id, + int render_view_id, + int notification_id) OVERRIDE; + virtual bool CanCreateWindow( + const GURL& opener_url, + const GURL& origin, + WindowContainerType container_type, + content::ResourceContext* context, + int render_process_id, + bool* no_javascript_access) OVERRIDE; + virtual std::string GetWorkerProcessTitle( + const GURL& url, content::ResourceContext* context) OVERRIDE; + virtual void ResourceDispatcherHostCreated() OVERRIDE; + virtual content::SpeechRecognitionManagerDelegate* + GetSpeechRecognitionManagerDelegate() OVERRIDE; + virtual ui::Clipboard* GetClipboard() OVERRIDE; + virtual net::NetLog* GetNetLog() OVERRIDE; + virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE; + virtual bool IsFastShutdownPossible() OVERRIDE; + virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh, + const GURL& url, + WebPreferences* prefs) OVERRIDE; + virtual void UpdateInspectorSetting(content::RenderViewHost* rvh, + const std::string& key, + const std::string& value) OVERRIDE; + virtual void ClearInspectorSettings(content::RenderViewHost* rvh) OVERRIDE; + virtual void BrowserURLHandlerCreated( + content::BrowserURLHandler* handler) OVERRIDE; + virtual void ClearCache(content::RenderViewHost* rvh) OVERRIDE; + virtual void ClearCookies(content::RenderViewHost* rvh) OVERRIDE; + virtual FilePath GetDefaultDownloadDirectory() OVERRIDE; + virtual std::string GetDefaultDownloadName() OVERRIDE; + virtual bool AllowSocketAPI(content::BrowserContext* browser_context, + const GURL& url) OVERRIDE; + +#if defined(OS_POSIX) && !defined(OS_MACOSX) + virtual int GetCrashSignalFD(const CommandLine& command_line) OVERRIDE; +#endif + +#if defined(OS_WIN) + virtual const wchar_t* GetResourceDllName() OVERRIDE; +#endif + +#if defined(USE_NSS) + virtual + crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate( + const GURL& url) OVERRIDE; +#endif + + content::ShellBrowserContext* browser_context(); + + private: + scoped_ptr<content::ShellResourceDispatcherHostDelegate> + resource_dispatcher_host_delegate_; + + ShellBrowserMainParts* shell_browser_main_parts_; + + DISALLOW_COPY_AND_ASSIGN(ShellContentBrowserClient); +}; + +} // namespace shell +} // namespace ash + +#endif // ASH_SHELL_CONTENT_CLIENT_SHELL_CONTENT_BROWSER_CLIENT_H_ diff --git a/ash/shell/content_client/shell_main_delegate.cc b/ash/shell/content_client/shell_main_delegate.cc new file mode 100644 index 0000000..660901e --- /dev/null +++ b/ash/shell/content_client/shell_main_delegate.cc @@ -0,0 +1,108 @@ +// 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 "ash/shell/content_client/shell_main_delegate.h" + +#include "ash/shell/content_client/shell_content_browser_client.h" +#include "base/command_line.h" +#include "base/file_path.h" +#include "base/path_service.h" +#include "content/public/browser/browser_main_runner.h" +#include "content/public/common/content_switches.h" +#include "content/shell/shell_content_plugin_client.h" +#include "content/shell/shell_content_renderer_client.h" +#include "content/shell/shell_content_utility_client.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" + +namespace ash { +namespace shell { +namespace { + +int ShellBrowserMain( + const content::MainFunctionParams& main_function_params) { + scoped_ptr<content::BrowserMainRunner> main_runner( + content::BrowserMainRunner::Create()); + int exit_code = main_runner->Initialize(main_function_params); + if (exit_code >= 0) + return exit_code; + exit_code = main_runner->Run(); + main_runner->Shutdown(); + return exit_code; +} + +} + +ShellMainDelegate::ShellMainDelegate() { +} + +ShellMainDelegate::~ShellMainDelegate() { +} + +bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { + return false; +} + +void ShellMainDelegate::PreSandboxStartup() { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + std::string process_type = + command_line.GetSwitchValueASCII(switches::kProcessType); + + content::SetContentClient(&content_client_); + InitializeShellContentClient(process_type); + + InitializeResourceBundle(); +} + +void ShellMainDelegate::SandboxInitialized(const std::string& process_type) { +} + +int ShellMainDelegate::RunProcess( + const std::string& process_type, + const content::MainFunctionParams& main_function_params) { + if (process_type != "") + return -1; + + return ShellBrowserMain(main_function_params); +} + +void ShellMainDelegate::ProcessExiting(const std::string& process_type) { +} + +#if defined(OS_POSIX) +content::ZygoteForkDelegate* ShellMainDelegate::ZygoteStarting() { + return NULL; +} + +void ShellMainDelegate::ZygoteForked() { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + std::string process_type = + command_line.GetSwitchValueASCII(switches::kProcessType); + InitializeShellContentClient(process_type); +} +#endif + +void ShellMainDelegate::InitializeShellContentClient( + const std::string& process_type) { + if (process_type.empty()) { + browser_client_.reset(new ShellContentBrowserClient); + content::GetContentClient()->set_browser(browser_client_.get()); + } else if (process_type == switches::kRendererProcess) { + renderer_client_.reset(new content::ShellContentRendererClient); + content::GetContentClient()->set_renderer(renderer_client_.get()); + } else if (process_type == switches::kPluginProcess) { + plugin_client_.reset(new content::ShellContentPluginClient); + content::GetContentClient()->set_plugin(plugin_client_.get()); + } else if (process_type == switches::kUtilityProcess) { + utility_client_.reset(new content::ShellContentUtilityClient); + content::GetContentClient()->set_utility(utility_client_.get()); + } +} + +void ShellMainDelegate::InitializeResourceBundle() { + ui::ResourceBundle::InitSharedInstanceWithLocale("en-US"); +} + +} // namespace shell +} // namespace ash diff --git a/ash/shell/content_client/shell_main_delegate.h b/ash/shell/content_client/shell_main_delegate.h new file mode 100644 index 0000000..bf04eab --- /dev/null +++ b/ash/shell/content_client/shell_main_delegate.h @@ -0,0 +1,64 @@ +// 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 ASH_SHELL_CONTENT_CLIENT_SHELL_MAIN_DELEGATE_H_ +#define ASH_SHELL_CONTENT_CLIENT_SHELL_MAIN_DELEGATE_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "content/shell/shell_content_client.h" +#include "content/public/app/content_main_delegate.h" + +namespace content { +class ShellContentRendererClient; +class ShellContentPluginClient; +class ShellContentUtilityClient; +} + +namespace ash { +namespace shell { + +class ShellContentBrowserClient; + +class ShellMainDelegate : public content::ContentMainDelegate { + public: + ShellMainDelegate(); + virtual ~ShellMainDelegate(); + + virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; + virtual void PreSandboxStartup() OVERRIDE; + virtual void SandboxInitialized(const std::string& process_type) OVERRIDE; + virtual int RunProcess( + const std::string& process_type, + const content::MainFunctionParams& main_function_params) OVERRIDE; + virtual void ProcessExiting(const std::string& process_type) OVERRIDE; +#if defined(OS_MACOSX) + virtual bool ProcessRegistersWithSystemProcess( + const std::string& process_type) OVERRIDE; + virtual bool ShouldSendMachPort(const std::string& process_type) OVERRIDE; + virtual bool DelaySandboxInitialization( + const std::string& process_type) OVERRIDE; +#elif defined(OS_POSIX) + virtual content::ZygoteForkDelegate* ZygoteStarting() OVERRIDE; + virtual void ZygoteForked() OVERRIDE; +#endif // OS_MACOSX + + private: + void InitializeShellContentClient(const std::string& process_type); + void InitializeResourceBundle(); + + scoped_ptr<ShellContentBrowserClient> browser_client_; + scoped_ptr<content::ShellContentRendererClient> renderer_client_; + scoped_ptr<content::ShellContentPluginClient> plugin_client_; + scoped_ptr<content::ShellContentUtilityClient> utility_client_; + content::ShellContentClient content_client_; + + DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate); +}; + +} // namespace shell +} // namespace ash + +#endif // ASH_SHELL_CONTENT_CLIENT_SHELL_MAIN_DELEGATE_H_ diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc index 3a5c699..303d172 100644 --- a/ash/shell/shell_main.cc +++ b/ash/shell/shell_main.cc @@ -2,102 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <map> - -#include "ash/launcher/launcher.h" -#include "ash/launcher/launcher_delegate.h" -#include "ash/launcher/launcher_model.h" -#include "ash/launcher/launcher_types.h" -#include "ash/shell.h" -#include "ash/shell_delegate.h" -#include "ash/shell_factory.h" -#include "ash/shell_window_ids.h" -#include "ash/shell/launcher_delegate_impl.h" -#include "ash/shell/shell_delegate_impl.h" -#include "ash/shell/shell_main_parts.h" -#include "ash/shell/window_watcher.h" -#include "base/at_exit.h" -#include "base/command_line.h" -#include "base/memory/scoped_ptr.h" -#include "base/message_loop.h" -#include "ui/aura/env.h" -#include "ui/aura/client/window_types.h" -#include "ui/aura/root_window.h" -#include "ui/aura/window_observer.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/ui_base_paths.h" -#include "ui/gfx/canvas.h" -#include "ui/gfx/compositor/test/compositor_test_support.h" -#include "ui/views/test/test_views_delegate.h" -#include "ui/views/widget/widget.h" -#include "ui/views/widget/widget_delegate.h" - -namespace { - -class ShellViewsDelegate : public views::TestViewsDelegate { - public: - ShellViewsDelegate() {} - virtual ~ShellViewsDelegate() {} - - // Overridden from views::TestViewsDelegate: - virtual views::NonClientFrameView* CreateDefaultNonClientFrameView( - views::Widget* widget) OVERRIDE { - return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget); - } - bool UseTransparentWindows() const OVERRIDE { - // Ash uses transparent window frames. - return true; - } - - private: - DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate); -}; - -} // namespace - -namespace ash { -namespace shell { - -void InitWindowTypeLauncher(); - -} // namespace shell -} // namespace ash - -int main(int argc, char** argv) { - CommandLine::Init(argc, argv); - - // The exit manager is in charge of calling the dtors of singleton objects. - base::AtExitManager exit_manager; - - ash::shell::PreMainMessageLoopStart(); - - // Create the message-loop here before creating the root window. - MessageLoop message_loop(MessageLoop::TYPE_UI); - ui::CompositorTestSupport::Initialize(); - - // A ViewsDelegate is required. - if (!views::ViewsDelegate::views_delegate) - views::ViewsDelegate::views_delegate = new ShellViewsDelegate; - - ash::shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl; - ash::Shell::CreateInstance(delegate); - - scoped_ptr<ash::shell::WindowWatcher> window_watcher( - new ash::shell::WindowWatcher); - delegate->SetWatcher(window_watcher.get()); - - ash::shell::InitWindowTypeLauncher(); - - ash::Shell::GetRootWindow()->ShowRootWindow(); - MessageLoopForUI::current()->Run(); - - window_watcher.reset(); - - ash::Shell::DeleteInstance(); - - aura::Env::DeleteInstance(); - - ui::CompositorTestSupport::Terminate(); - - return 0; +#include "content/public/app/content_main.h" +#include "sandbox/src/sandbox_types.h" +#include "ash/shell/content_client/shell_main_delegate.h" + +#if defined(OS_WIN) +#include "content/public/app/startup_helper_win.h" +#endif + +#if defined(OS_WIN) +int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { + sandbox::SandboxInterfaceInfo sandbox_info = {0}; + content::InitializeSandboxInfo(&sandbox_info); + ash::shell::ShellMainDelegate delegate; + return content::ContentMain(instance, &sandbox_info, &delegate); +} +#else +int main(int argc, const char** argv) { + ash::shell::ShellMainDelegate delegate; + return content::ContentMain(argc, argv, &delegate); } +#endif diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc index c6f5427..f3abad2 100644 --- a/ash/shell/window_type_launcher.cc +++ b/ash/shell/window_type_launcher.cc @@ -308,8 +308,9 @@ void WindowTypeLauncher::ButtonPressed(views::Button* sender, } #if !defined(OS_MACOSX) else if (sender == examples_button_) { - views::examples::ShowExamplesWindow(views::examples::DO_NOTHING_ON_CLOSE, - NULL); + views::examples::ShowExamplesWindow( + views::examples::DO_NOTHING_ON_CLOSE, + ash::Shell::GetInstance()->browser_context()); } #endif // !defined(OS_MACOSX) } diff --git a/content/content_shell.gypi b/content/content_shell.gypi index 8e8c7be..0556fe5 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -53,6 +53,7 @@ 'shell/paths_mac.mm', 'shell/shell.cc', 'shell/shell.h', + 'shell/shell_aura.cc', 'shell/shell_gtk.cc', 'shell/shell_mac.mm', 'shell/shell_win.cc', @@ -137,6 +138,12 @@ }, }, }], # OS=="win" + ['use_aura==1', { + 'sources/': [ + ['exclude', 'shell/shell_gtk.cc'], + ['exclude', 'shell/shell_win.cc'], + ], + }], ], }, { diff --git a/content/shell/shell.cc b/content/shell/shell.cc index 55c9ad8..937637d 100644 --- a/content/shell/shell.cc +++ b/content/shell/shell.cc @@ -32,7 +32,7 @@ Shell::Shell(WebContents* web_contents) wait_until_done_(false), window_(NULL), url_edit_view_(NULL) -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(USE_AURA) , default_edit_wnd_proc_(0) #endif { diff --git a/content/shell/shell.h b/content/shell/shell.h index 1fc519a..2c8c23f 100644 --- a/content/shell/shell.h +++ b/content/shell/shell.h @@ -16,7 +16,7 @@ #include "content/public/browser/web_contents_observer.h" #include "ui/gfx/native_widget_types.h" -#if defined(OS_LINUX) +#if defined(TOOLKIT_GTK) #include <gtk/gtk.h> #include "ui/base/gtk/gtk_signal.h" @@ -107,7 +107,7 @@ class Shell : public WebContentsDelegate, // Sets whether the spinner is spinning. void PlatformSetIsLoading(bool loading); -#if defined(OS_WIN) || defined(OS_LINUX) +#if (defined(OS_WIN) && !defined(USE_AURA)) || defined(TOOLKIT_GTK) // Resizes the main window to the given dimensions. void SizeTo(int width, int height); #endif @@ -132,11 +132,11 @@ class Shell : public WebContentsDelegate, const GURL& validated_url, bool is_main_frame) OVERRIDE; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(USE_AURA) static ATOM RegisterWindowClass(); static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); static LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM); -#elif defined(OS_LINUX) +#elif defined(TOOLKIT_GTK) CHROMEGTK_CALLBACK_0(Shell, void, OnBackButtonClicked); CHROMEGTK_CALLBACK_0(Shell, void, OnForwardButtonClicked); CHROMEGTK_CALLBACK_0(Shell, void, OnReloadButtonClicked); @@ -160,10 +160,10 @@ class Shell : public WebContentsDelegate, gfx::NativeWindow window_; gfx::NativeEditView url_edit_view_; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(USE_AURA) WNDPROC default_edit_wnd_proc_; static HINSTANCE instance_handle_; -#elif defined(OS_LINUX) +#elif defined(TOOLKIT_GTK) GtkWidget* vbox_; GtkToolItem* back_button_; diff --git a/content/shell/shell_aura.cc b/content/shell/shell_aura.cc new file mode 100644 index 0000000..0212106 --- /dev/null +++ b/content/shell/shell_aura.cc @@ -0,0 +1,44 @@ +// 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 "content/shell/shell.h" + +namespace content { + +// static +void Shell::PlatformInitialize() { +} + +base::StringPiece Shell::PlatformResourceProvider(int key) { + return base::StringPiece(); +} + +void Shell::PlatformExit() { +} + +void Shell::PlatformCleanUp() { +} + +void Shell::PlatformEnableUIControl(UIControl control, bool is_enabled) { +} + +void Shell::PlatformSetAddressBarURL(const GURL& url) { +} + +void Shell::PlatformSetIsLoading(bool loading) { +} + +void Shell::PlatformCreateWindow(int width, int height) { +} + +void Shell::PlatformSetContents() { +} + +void Shell::PlatformResizeSubViews() { +} + +void Shell::Close() { +} + +} // namespace content diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc index 2f6e95c..6f10b13 100644 --- a/content/shell/shell_download_manager_delegate.cc +++ b/content/shell/shell_download_manager_delegate.cc @@ -105,7 +105,7 @@ void ShellDownloadManagerDelegate::ChooseDownloadPath( const FilePath& suggested_path, int32 download_id) { FilePath result; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(USE_AURA) std::wstring file_part = FilePath(suggested_path).BaseName().value(); wchar_t file_name[MAX_PATH]; base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); diff --git a/ui/views/examples/examples_main.cc b/ui/views/examples/examples_main.cc index bd2fbf3..fc4e1b9 100644 --- a/ui/views/examples/examples_main.cc +++ b/ui/views/examples/examples_main.cc @@ -21,4 +21,5 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { int main(int argc, const char** argv) { views::examples::ExamplesMainDelegate delegate; return content::ContentMain(argc, argv, &delegate); +} #endif |