diff options
author | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-12 19:11:25 +0000 |
---|---|---|
committer | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-12 19:11:25 +0000 |
commit | 3d61a7f64764bd622a96176fdf9aa945de283ac7 (patch) | |
tree | 87565f129f90b18d3b9809dd912e868a8782d08d /chrome | |
parent | b2969cfbd06a757cd5e8d66efc3c3224dc7f3113 (diff) | |
download | chromium_src-3d61a7f64764bd622a96176fdf9aa945de283ac7.zip chromium_src-3d61a7f64764bd622a96176fdf9aa945de283ac7.tar.gz chromium_src-3d61a7f64764bd622a96176fdf9aa945de283ac7.tar.bz2 |
Move WebstoreInstaller, WebstoreInlineInstaller, related in extensions namespace
BUG=136833, 117261
Review URL: https://chromiumcodereview.appspot.com/10703142
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
16 files changed, 64 insertions, 34 deletions
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index cf13178..87d4aa8 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -510,7 +510,7 @@ bool ChromeDownloadManagerDelegate::IsDangerousFile( // will not offer to install the extension. if (extensions::switch_utils::IsEasyOffStoreInstallEnabled() && download_crx_util::IsExtensionDownload(download) && - !WebstoreInstaller::GetAssociatedApproval(download)) { + !extensions::WebstoreInstaller::GetAssociatedApproval(download)) { return true; } diff --git a/chrome/browser/download/download_crx_util.cc b/chrome/browser/download/download_crx_util.cc index 016bac0..95d3843 100644 --- a/chrome/browser/download/download_crx_util.cc +++ b/chrome/browser/download/download_crx_util.cc @@ -19,6 +19,7 @@ using content::BrowserThread; using content::DownloadItem; +using extensions::WebstoreInstaller; namespace download_crx_util { diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 23c0f01..61ce008 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -78,13 +78,14 @@ scoped_refptr<CrxInstaller> CrxInstaller::Create( scoped_refptr<CrxInstaller> CrxInstaller::Create( ExtensionService* frontend, ExtensionInstallPrompt* client, - const WebstoreInstaller::Approval* approval) { + const extensions::WebstoreInstaller::Approval* approval) { return new CrxInstaller(frontend->AsWeakPtr(), client, approval); } -CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, - ExtensionInstallPrompt* client, - const WebstoreInstaller::Approval* approval) +CrxInstaller::CrxInstaller( + base::WeakPtr<ExtensionService> frontend_weak, + ExtensionInstallPrompt* client, + const extensions::WebstoreInstaller::Approval* approval) : install_directory_(frontend_weak->install_directory()), install_source_(Extension::INTERNAL), approved_(false), diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index 8d7ce49..8fe1c48 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h @@ -75,7 +75,7 @@ class CrxInstaller static scoped_refptr<CrxInstaller> Create( ExtensionService* frontend, ExtensionInstallPrompt* client, - const WebstoreInstaller::Approval* approval); + const extensions::WebstoreInstaller::Approval* approval); // Install the crx in |source_file|. void InstallCrx(const FilePath& source_file); @@ -176,7 +176,7 @@ class CrxInstaller CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, ExtensionInstallPrompt* client, - const WebstoreInstaller::Approval* approval); + const extensions::WebstoreInstaller::Approval* approval); virtual ~CrxInstaller(); // Converts the source user script to an extension. diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc index 7703f77..f4f243c 100644 --- a/chrome/browser/extensions/crx_installer_browsertest.cc +++ b/chrome/browser/extensions/crx_installer_browsertest.cc @@ -92,12 +92,13 @@ class ExtensionCrxInstallerTest : public ExtensionBrowserTest { if (!parsed_manifest) return scoped_refptr<CrxInstaller>(); - scoped_ptr<WebstoreInstaller::Approval> approval; + scoped_ptr<extensions::WebstoreInstaller::Approval> approval; if (!id.empty()) { - approval = WebstoreInstaller::Approval::CreateWithNoInstallPrompt( - browser()->profile(), - id, - scoped_ptr<base::DictionaryValue>(parsed_manifest)); + approval = + extensions::WebstoreInstaller::Approval::CreateWithNoInstallPrompt( + browser()->profile(), + id, + scoped_ptr<base::DictionaryValue>(parsed_manifest)); } scoped_refptr<CrxInstaller> installer( diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc index 563236a..b7519268 100644 --- a/chrome/browser/extensions/extension_tab_helper.cc +++ b/chrome/browser/extensions/extension_tab_helper.cc @@ -253,13 +253,14 @@ void ExtensionTabHelper::OnInlineWebstoreInstall( int return_route_id, const std::string& webstore_item_id, const GURL& requestor_url) { - scoped_refptr<WebstoreInlineInstaller> installer(new WebstoreInlineInstaller( - web_contents(), - install_id, - return_route_id, - webstore_item_id, - requestor_url, - this)); + scoped_refptr<extensions::WebstoreInlineInstaller> installer( + new extensions::WebstoreInlineInstaller( + web_contents(), + install_id, + return_route_id, + webstore_item_id, + requestor_url, + this)); installer->BeginInstall(); } diff --git a/chrome/browser/extensions/extension_tab_helper.h b/chrome/browser/extensions/extension_tab_helper.h index d579ee8..723de2b 100644 --- a/chrome/browser/extensions/extension_tab_helper.h +++ b/chrome/browser/extensions/extension_tab_helper.h @@ -38,7 +38,7 @@ class ExtensionTabHelper : public content::WebContentsObserver, public ExtensionFunctionDispatcher::Delegate, public ImageLoadingTracker::Observer, - public WebstoreInlineInstaller::Delegate, + public extensions::WebstoreInlineInstaller::Delegate, public AppNotifyChannelSetup::Delegate, public base::SupportsWeakPtr<ExtensionTabHelper>, public content::NotificationObserver { @@ -170,7 +170,7 @@ class ExtensionTabHelper const std::string& extension_id, int index) OVERRIDE; - // WebstoreInlineInstaller::Delegate. + // extensions::WebstoreInlineInstaller::Delegate. virtual void OnInlineInstallSuccess(int install_id, int return_route_id) OVERRIDE; virtual void OnInlineInstallFailure(int install_id, diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc index 551be76..09c7f40 100644 --- a/chrome/browser/extensions/webstore_inline_installer.cc +++ b/chrome/browser/extensions/webstore_inline_installer.cc @@ -34,6 +34,8 @@ using content::UtilityProcessHost; using content::UtilityProcessHostClient; using content::WebContents; +namespace extensions { + const char kManifestKey[] = "manifest"; const char kIconUrlKey[] = "icon_url"; const char kLocalizedNameKey[] = "localized_name"; @@ -164,7 +166,7 @@ WebstoreInlineInstaller::WebstoreInlineInstaller(WebContents* web_contents, void WebstoreInlineInstaller::BeginInstall() { AddRef(); // Balanced in CompleteInstall or WebContentsDestroyed. - if (!extensions::Extension::IdIsValid(id_)) { + if (!Extension::IdIsValid(id_)) { CompleteInstall(kInvalidWebstoreItemId); return; } @@ -455,3 +457,5 @@ bool WebstoreInlineInstaller::IsRequestorURLInVerifiedSite( return verified_site_pattern.MatchesURL(requestor_url); } + +} // namespace extensions diff --git a/chrome/browser/extensions/webstore_inline_installer.h b/chrome/browser/extensions/webstore_inline_installer.h index 4189012..c01b481 100644 --- a/chrome/browser/extensions/webstore_inline_installer.h +++ b/chrome/browser/extensions/webstore_inline_installer.h @@ -18,16 +18,15 @@ #include "net/url_request/url_fetcher_delegate.h" #include "third_party/skia/include/core/SkBitmap.h" -class SafeWebstoreResponseParser; - -namespace extensions { -class Extension; -} namespace net { class URLFetcher; } +namespace extensions { +class Extension; +class SafeWebstoreResponseParser; + // Manages inline installs requested by a page (downloads and parses metadata // from the webstore, shows the install UI, starts the download once the user // confirms). Clients must implement the WebstoreInlineInstaller::Delegate @@ -134,10 +133,12 @@ class WebstoreInlineInstaller int rating_count_; scoped_ptr<DictionaryValue> webstore_data_; scoped_ptr<DictionaryValue> manifest_; - scoped_refptr<extensions::Extension> dummy_extension_; + scoped_refptr<Extension> dummy_extension_; SkBitmap icon_; DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreInlineInstaller); }; +} // namespace extensions + #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ diff --git a/chrome/browser/extensions/webstore_inline_installer_unittest.cc b/chrome/browser/extensions/webstore_inline_installer_unittest.cc index e5616bf..586738c 100644 --- a/chrome/browser/extensions/webstore_inline_installer_unittest.cc +++ b/chrome/browser/extensions/webstore_inline_installer_unittest.cc @@ -6,6 +6,8 @@ #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" +namespace extensions { + // A macro, so that the IsRequestorURLInVerifiedSite calls are inside of the // the test, which is marked as a friend of WebstoreInlineInstaller. #define IsVerified(requestor_url, verified_site) \ @@ -69,3 +71,5 @@ TEST(WebstoreInlineInstallerTest, DomainVerification) { EXPECT_TRUE(IsVerified( "http://example.com:123/path/page.html", "example.com:123/path")); } + +} // namespace extensions diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc index 98219dc..f1960b5 100644 --- a/chrome/browser/extensions/webstore_install_helper.cc +++ b/chrome/browser/extensions/webstore_install_helper.cc @@ -25,6 +25,8 @@ const char kImageDecodeError[] = "Image decode failed"; } // namespace +namespace extensions { + WebstoreInstallHelper::WebstoreInstallHelper( Delegate* delegate, const std::string& id, @@ -195,3 +197,5 @@ void WebstoreInstallHelper::ReportResultFromUIThread() { else delegate_->OnWebstoreParseFailure(id_, parse_error_, error_); } + +} // namespace extensions diff --git a/chrome/browser/extensions/webstore_install_helper.h b/chrome/browser/extensions/webstore_install_helper.h index c9e1296..5d5c83f 100644 --- a/chrome/browser/extensions/webstore_install_helper.h +++ b/chrome/browser/extensions/webstore_install_helper.h @@ -30,6 +30,8 @@ class URLFetcher; class URLRequestContextGetter; } +namespace extensions { + // This is a class to help dealing with webstore-provided data. It manages // sending work to the utility process for parsing manifests and // fetching/decoding icon data. Clients must implement the @@ -132,4 +134,6 @@ class WebstoreInstallHelper : public content::UtilityProcessHostClient, Delegate::InstallHelperResultCode parse_error_; }; +} // namespace extensions + #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALL_HELPER_H_ diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index c17fe54..faf29c9 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -52,8 +52,6 @@ using content::DownloadUrlParameters; namespace { -using extensions::Extension; - // Key used to attach the Approval to the DownloadItem. const char kApprovalKey[] = "extensions.webstore_installer"; @@ -135,6 +133,8 @@ void GetDownloadFilePath( } // namespace +namespace extensions { + WebstoreInstaller::Approval::Approval() : profile(NULL), use_app_installed_bubble(false), @@ -358,3 +358,5 @@ void WebstoreInstaller::ReportSuccess() { Release(); // Balanced in Start(). } + +} // namespace extensions diff --git a/chrome/browser/extensions/webstore_installer.h b/chrome/browser/extensions/webstore_installer.h index 0c7373b..8d2ebb1 100644 --- a/chrome/browser/extensions/webstore_installer.h +++ b/chrome/browser/extensions/webstore_installer.h @@ -26,6 +26,8 @@ namespace content { class NavigationController; } +namespace extensions { + // Downloads and installs extensions from the web store. class WebstoreInstaller : public content::NotificationObserver, public content::DownloadItem::Observer, @@ -159,4 +161,6 @@ class WebstoreInstaller : public content::NotificationObserver, GURL download_url_; }; +} // namespace extensions + #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc index b3c79f9..a3d9a43 100644 --- a/chrome/browser/ui/intents/web_intent_picker_controller.cc +++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc @@ -48,6 +48,8 @@ #include "ui/gfx/image/image.h" #include "webkit/glue/web_intent_service_data.h" +using extensions::WebstoreInstaller; + namespace { const char kShareActionURL[] = "http://webintents.org/share"; diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.h b/chrome/browser/ui/intents/web_intent_picker_controller.h index c6003f8..487f76cd 100644 --- a/chrome/browser/ui/intents/web_intent_picker_controller.h +++ b/chrome/browser/ui/intents/web_intent_picker_controller.h @@ -40,9 +40,10 @@ struct WebIntentServiceData; // Controls the creation of the WebIntentPicker UI and forwards the user's // intent handler choice back to the WebContents object. -class WebIntentPickerController : public content::NotificationObserver, - public WebIntentPickerDelegate, - public WebstoreInstaller::Delegate { +class WebIntentPickerController + : public content::NotificationObserver, + public WebIntentPickerDelegate, + public extensions::WebstoreInstaller::Delegate { public: explicit WebIntentPickerController(TabContents* tab_contents); virtual ~WebIntentPickerController(); @@ -74,7 +75,7 @@ class WebIntentPickerController : public content::NotificationObserver, virtual void OnChooseAnotherService() OVERRIDE; virtual void OnClosing() OVERRIDE; - // WebstoreInstaller::Delegate implementation. + // extensions::WebstoreInstaller::Delegate implementation. virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; virtual void OnExtensionInstallFailure(const std::string& id, const std::string& error) OVERRIDE; |