OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // post-install UI after successful installation. | 24 // post-install UI after successful installation. |
25 // | 25 // |
26 // Clients will be notified of success or failure via the |callback| argument | 26 // Clients will be notified of success or failure via the |callback| argument |
27 // passed into the constructor. | 27 // passed into the constructor. |
28 class WebstoreInlineInstaller : public WebstoreStandaloneInstaller, | 28 class WebstoreInlineInstaller : public WebstoreStandaloneInstaller, |
29 public content::WebContentsObserver { | 29 public content::WebContentsObserver { |
30 public: | 30 public: |
31 typedef WebstoreStandaloneInstaller::Callback Callback; | 31 typedef WebstoreStandaloneInstaller::Callback Callback; |
32 | 32 |
33 WebstoreInlineInstaller(content::WebContents* web_contents, | 33 WebstoreInlineInstaller(content::WebContents* web_contents, |
| 34 content::RenderFrameHost* host, |
34 const std::string& webstore_item_id, | 35 const std::string& webstore_item_id, |
35 const GURL& requestor_url, | 36 const GURL& requestor_url, |
36 const Callback& callback); | 37 const Callback& callback); |
37 | 38 |
38 // Returns true if given |requestor_url| is a verified site according to the | 39 // Returns true if given |requestor_url| is a verified site according to the |
39 // given |webstore_data|. | 40 // given |webstore_data|. |
40 static bool IsRequestorPermitted(const base::DictionaryValue& webstore_data, | 41 static bool IsRequestorPermitted(const base::DictionaryValue& webstore_data, |
41 const GURL& requestor_url, | 42 const GURL& requestor_url, |
42 std::string* error); | 43 std::string* error); |
43 | 44 |
(...skipping 10 matching lines...) Expand all Loading... |
54 content::WebContents* GetWebContents() const override; | 55 content::WebContents* GetWebContents() const override; |
55 scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt() | 56 scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt() |
56 const override; | 57 const override; |
57 bool CheckInlineInstallPermitted(const base::DictionaryValue& webstore_data, | 58 bool CheckInlineInstallPermitted(const base::DictionaryValue& webstore_data, |
58 std::string* error) const override; | 59 std::string* error) const override; |
59 bool CheckRequestorPermitted(const base::DictionaryValue& webstore_data, | 60 bool CheckRequestorPermitted(const base::DictionaryValue& webstore_data, |
60 std::string* error) const override; | 61 std::string* error) const override; |
61 | 62 |
62 private: | 63 private: |
63 // content::WebContentsObserver interface implementation. | 64 // content::WebContentsObserver interface implementation. |
| 65 void FrameDeleted(content::RenderFrameHost* render_frame_host) override; |
| 66 void RenderFrameHostChanged(content::RenderFrameHost* old_host, |
| 67 content::RenderFrameHost* new_host) override; |
64 void WebContentsDestroyed() override; | 68 void WebContentsDestroyed() override; |
65 | 69 |
66 // Checks whether the install is initiated by a page in a verified site | 70 // Checks whether the install is initiated by a page in a verified site |
67 // (which is at least a domain, but can also have a port or a path). | 71 // (which is at least a domain, but can also have a port or a path). |
68 static bool IsRequestorURLInVerifiedSite(const GURL& requestor_url, | 72 static bool IsRequestorURLInVerifiedSite(const GURL& requestor_url, |
69 const std::string& verified_site); | 73 const std::string& verified_site); |
70 | 74 |
| 75 // This corresponds to the frame that initiated the install request. |
| 76 content::RenderFrameHost* host_; |
71 GURL requestor_url_; | 77 GURL requestor_url_; |
72 | 78 |
73 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreInlineInstaller); | 79 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreInlineInstaller); |
74 }; | 80 }; |
75 | 81 |
76 } // namespace extensions | 82 } // namespace extensions |
77 | 83 |
78 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ | 84 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INLINE_INSTALLER_H_ |
OLD | NEW |