Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Side by Side Diff: chrome/browser/extensions/webstore_inline_installer.h

Issue 1554233005: Don't allow inline install if frame is deleted before user accepts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 DidNavigateAnyFrame(content::RenderFrameHost* render_frame_host,
66 const content::LoadCommittedDetails& details,
67 const content::FrameNavigateParams& params) 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_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/tab_helper.cc ('k') | chrome/browser/extensions/webstore_inline_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698