Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 WebstoreInlineInstaller(content::WebContents* web_contents, | 45 WebstoreInlineInstaller(content::WebContents* web_contents, |
| 46 int install_id, | 46 int install_id, |
| 47 std::string webstore_item_id, | 47 std::string webstore_item_id, |
| 48 GURL requestor_url, | 48 GURL requestor_url, |
| 49 Delegate* d); | 49 Delegate* d); |
| 50 void BeginInstall(); | 50 void BeginInstall(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 friend class base::RefCountedThreadSafe<WebstoreInlineInstaller>; | 53 friend class base::RefCountedThreadSafe<WebstoreInlineInstaller>; |
| 54 friend class SafeWebstoreResponseParser; | 54 friend class SafeWebstoreResponseParser; |
| 55 FRIEND_TEST_ALL_PREFIXES(WebstoreInlineInstallerTest, DomainVerification); | |
| 55 | 56 |
| 56 virtual ~WebstoreInlineInstaller(); | 57 virtual ~WebstoreInlineInstaller(); |
| 57 | 58 |
| 58 // Several delegate/client inteface implementations follow. The normal flow | 59 // Several delegate/client inteface implementations follow. The normal flow |
| 59 // (for successful installs) is: | 60 // (for successful installs) is: |
| 60 // | 61 // |
| 61 // 1. BeginInstall: starts the fetch of data from the webstore | 62 // 1. BeginInstall: starts the fetch of data from the webstore |
| 62 // 2. OnURLFetchComplete: starts the parsing of data from the webstore | 63 // 2. OnURLFetchComplete: starts the parsing of data from the webstore |
| 63 // 3. OnWebstoreResponseParseSuccess: starts the parsing of the manifest and | 64 // 3. OnWebstoreResponseParseSuccess: starts the parsing of the manifest and |
| 64 // fetching of icon data. | 65 // fetching of icon data. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 93 virtual void WebContentsDestroyed( | 94 virtual void WebContentsDestroyed( |
| 94 content::WebContents* web_contents) OVERRIDE; | 95 content::WebContents* web_contents) OVERRIDE; |
| 95 | 96 |
| 96 // WebstoreInstaller::Delegate interface implementation. | 97 // WebstoreInstaller::Delegate interface implementation. |
| 97 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; | 98 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; |
| 98 virtual void OnExtensionInstallFailure(const std::string& id, | 99 virtual void OnExtensionInstallFailure(const std::string& id, |
| 99 const std::string& error) OVERRIDE; | 100 const std::string& error) OVERRIDE; |
| 100 | 101 |
| 101 void CompleteInstall(const std::string& error); | 102 void CompleteInstall(const std::string& error); |
| 102 | 103 |
| 104 // Checks whether the install is initiated by a page in the verified site | |
| 105 // (which is at least a domain, but can also have a port or a path). | |
| 106 static bool IsRequestorUrlInVerifiedSite(const GURL& requestor_url, | |
|
jstritar
2012/01/25 17:40:28
nit: we try to use URL rather than Url in extensio
Mihai Parparita -not on Chrome
2012/01/25 18:11:04
Done.
| |
| 107 const std::string& verified_site); | |
| 108 | |
| 103 int install_id_; | 109 int install_id_; |
| 104 std::string id_; | 110 std::string id_; |
| 105 GURL requestor_url_; | 111 GURL requestor_url_; |
| 106 Delegate* delegate_; | 112 Delegate* delegate_; |
| 107 | 113 |
| 108 // For fetching webstore JSON data. | 114 // For fetching webstore JSON data. |
| 109 scoped_ptr<content::URLFetcher> webstore_data_url_fetcher_; | 115 scoped_ptr<content::URLFetcher> webstore_data_url_fetcher_; |
| 110 | 116 |
| 111 // Extracted from the webstore JSON data response. | 117 // Extracted from the webstore JSON data response. |
| 112 std::string localized_name_; | 118 std::string localized_name_; |
| 113 std::string localized_description_; | 119 std::string localized_description_; |
| 114 std::string localized_user_count_; | 120 std::string localized_user_count_; |
| 115 double average_rating_; | 121 double average_rating_; |
| 116 int rating_count_; | 122 int rating_count_; |
| 117 scoped_ptr<DictionaryValue> webstore_data_; | 123 scoped_ptr<DictionaryValue> webstore_data_; |
| 118 scoped_ptr<DictionaryValue> manifest_; | 124 scoped_ptr<DictionaryValue> manifest_; |
| 119 scoped_refptr<Extension> dummy_extension_; | 125 scoped_refptr<Extension> dummy_extension_; |
| 120 SkBitmap icon_; | 126 SkBitmap icon_; |
| 121 | 127 |
| 122 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreInlineInstaller); | 128 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreInlineInstaller); |
| 123 }; | 129 }; |
| 124 | 130 |
| 125 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ | 131 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ |
| OLD | NEW |