diff --git a/atom.gyp b/atom.gyp index 21284c55e4e9..36fe2f01e5a5 100644 --- a/atom.gyp +++ b/atom.gyp @@ -47,6 +47,8 @@ 'atom/renderer/api/lib/web-view.coffee', ], 'lib_sources': [ + 'atom/app/atom_content_client.cc', + 'atom/app/atom_content_client.h', 'atom/app/atom_main_delegate.cc', 'atom/app/atom_main_delegate.h', 'atom/app/atom_main_delegate_mac.mm', diff --git a/atom/app/atom_content_client.cc b/atom/app/atom_content_client.cc new file mode 100644 index 000000000000..6f7a4e29a347 --- /dev/null +++ b/atom/app/atom_content_client.cc @@ -0,0 +1,21 @@ +// Copyright (c) 2014 GitHub, Inc. All rights reserved. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/app/atom_content_client.h" + +namespace atom { + +AtomContentClient::AtomContentClient() { +} + +AtomContentClient::~AtomContentClient() { +} + +void AtomContentClient::AddAdditionalSchemes( + std::vector* standard_schemes, + std::vector* savable_schemes) { + standard_schemes->push_back("chrome-extension"); +} + +} // namespace atom diff --git a/atom/app/atom_content_client.h b/atom/app/atom_content_client.h new file mode 100644 index 000000000000..89828445e85d --- /dev/null +++ b/atom/app/atom_content_client.h @@ -0,0 +1,29 @@ +// Copyright (c) 2014 GitHub, Inc. All rights reserved. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_APP_ATOM_CONTENT_CLIENT_H_ +#define ATOM_APP_ATOM_CONTENT_CLIENT_H_ + +#include "brightray/common/content_client.h" + +namespace atom { + +class AtomContentClient : public brightray::ContentClient { + public: + AtomContentClient(); + virtual ~AtomContentClient(); + + protected: + // content::ContentClient: + virtual void AddAdditionalSchemes( + std::vector* standard_schemes, + std::vector* savable_schemes) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(AtomContentClient); +}; + +} // namespace atom + +#endif // ATOM_APP_ATOM_CONTENT_CLIENT_H_ diff --git a/atom/app/atom_main_delegate.cc b/atom/app/atom_main_delegate.cc index e8dbd0bd9830..f754a1b347f0 100644 --- a/atom/app/atom_main_delegate.cc +++ b/atom/app/atom_main_delegate.cc @@ -6,6 +6,7 @@ #include +#include "atom/app/atom_content_client.h" #include "atom/browser/atom_browser_client.h" #include "atom/renderer/atom_renderer_client.h" #include "base/command_line.h" @@ -22,18 +23,6 @@ AtomMainDelegate::AtomMainDelegate() { AtomMainDelegate::~AtomMainDelegate() { } -void AtomMainDelegate::AddDataPackFromPath( - ui::ResourceBundle* bundle, const base::FilePath& pak_dir) { -#if defined(OS_WIN) - bundle->AddDataPackFromPath( - pak_dir.Append(FILE_PATH_LITERAL("ui_resources_200_percent.pak")), - ui::SCALE_FACTOR_200P); - bundle->AddDataPackFromPath( - pak_dir.Append(FILE_PATH_LITERAL("webkit_resources_200_percent.pak")), - ui::SCALE_FACTOR_200P); -#endif -} - bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { // Disable logging out to debug.log on Windows #if defined(OS_WIN) @@ -99,4 +88,20 @@ content::ContentRendererClient* return renderer_client_.get(); } +scoped_ptr AtomMainDelegate::CreateContentClient() { + return scoped_ptr(new AtomContentClient).Pass(); +} + +void AtomMainDelegate::AddDataPackFromPath( + ui::ResourceBundle* bundle, const base::FilePath& pak_dir) { +#if defined(OS_WIN) + bundle->AddDataPackFromPath( + pak_dir.Append(FILE_PATH_LITERAL("ui_resources_200_percent.pak")), + ui::SCALE_FACTOR_200P); + bundle->AddDataPackFromPath( + pak_dir.Append(FILE_PATH_LITERAL("webkit_resources_200_percent.pak")), + ui::SCALE_FACTOR_200P); +#endif +} + } // namespace atom diff --git a/atom/app/atom_main_delegate.h b/atom/app/atom_main_delegate.h index 72bc0f745af8..4afbf846eaa8 100644 --- a/atom/app/atom_main_delegate.h +++ b/atom/app/atom_main_delegate.h @@ -16,24 +16,23 @@ class AtomMainDelegate : public brightray::MainDelegate { ~AtomMainDelegate(); protected: - // brightray::MainDelegate: - virtual void AddDataPackFromPath( - ui::ResourceBundle* bundle, const base::FilePath& pak_dir) OVERRIDE; - // content::ContentMainDelegate: virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; virtual void PreSandboxStartup() OVERRIDE; + virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; + virtual content::ContentRendererClient* + CreateContentRendererClient() OVERRIDE; + // brightray::MainDelegate: + virtual scoped_ptr CreateContentClient() OVERRIDE; + virtual void AddDataPackFromPath( + ui::ResourceBundle* bundle, const base::FilePath& pak_dir) OVERRIDE; #if defined(OS_MACOSX) virtual void OverrideChildProcessPath() OVERRIDE; virtual void OverrideFrameworkBundlePath() OVERRIDE; #endif private: - virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; - virtual content::ContentRendererClient* - CreateContentRendererClient() OVERRIDE; - brightray::ContentClient content_client_; scoped_ptr browser_client_; scoped_ptr renderer_client_;