OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APPS_EPHEMERAL_APP_LAUNCHER_H_ | 5 #ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_LAUNCHER_H_ |
6 #define CHROME_BROWSER_APPS_EPHEMERAL_APP_LAUNCHER_H_ | 6 #define CHROME_BROWSER_APPS_EPHEMERAL_APP_LAUNCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 protected: | 60 protected: |
61 EphemeralAppLauncher(const std::string& webstore_item_id, | 61 EphemeralAppLauncher(const std::string& webstore_item_id, |
62 Profile* profile, | 62 Profile* profile, |
63 gfx::NativeWindow parent_window, | 63 gfx::NativeWindow parent_window, |
64 const LaunchCallback& callback); | 64 const LaunchCallback& callback); |
65 EphemeralAppLauncher(const std::string& webstore_item_id, | 65 EphemeralAppLauncher(const std::string& webstore_item_id, |
66 content::WebContents* web_contents, | 66 content::WebContents* web_contents, |
67 const LaunchCallback& callback); | 67 const LaunchCallback& callback); |
68 | 68 |
69 virtual ~EphemeralAppLauncher(); | 69 ~EphemeralAppLauncher() override; |
70 | 70 |
71 // Creates an install checker. Allows tests to mock the install checker. | 71 // Creates an install checker. Allows tests to mock the install checker. |
72 virtual scoped_ptr<extensions::ExtensionInstallChecker> | 72 virtual scoped_ptr<extensions::ExtensionInstallChecker> |
73 CreateInstallChecker(); | 73 CreateInstallChecker(); |
74 | 74 |
75 // WebstoreStandaloneInstaller implementation overridden in tests. | 75 // WebstoreStandaloneInstaller implementation overridden in tests. |
76 virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() override; | 76 scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() override; |
77 virtual scoped_ptr<extensions::WebstoreInstaller::Approval> CreateApproval() | 77 scoped_ptr<extensions::WebstoreInstaller::Approval> CreateApproval() |
78 const override; | 78 const override; |
79 | 79 |
80 private: | 80 private: |
81 friend class base::RefCountedThreadSafe<EphemeralAppLauncher>; | 81 friend class base::RefCountedThreadSafe<EphemeralAppLauncher>; |
82 friend class EphemeralAppLauncherTest; | 82 friend class EphemeralAppLauncherTest; |
83 | 83 |
84 // Returns true if an app that is already installed in extension system can | 84 // Returns true if an app that is already installed in extension system can |
85 // be launched. | 85 // be launched. |
86 bool CanLaunchInstalledApp(const extensions::Extension* extension, | 86 bool CanLaunchInstalledApp(const extensions::Extension* extension, |
87 extensions::webstore_install::Result* reason, | 87 extensions::webstore_install::Result* reason, |
(...skipping 21 matching lines...) Expand all Loading... |
109 void AbortLaunch(extensions::webstore_install::Result result, | 109 void AbortLaunch(extensions::webstore_install::Result result, |
110 const std::string& error); | 110 const std::string& error); |
111 | 111 |
112 // Determines whether the app can be installed ephemerally. | 112 // Determines whether the app can be installed ephemerally. |
113 void CheckEphemeralInstallPermitted(); | 113 void CheckEphemeralInstallPermitted(); |
114 | 114 |
115 // Install checker callback. | 115 // Install checker callback. |
116 void OnInstallChecked(int check_failures); | 116 void OnInstallChecked(int check_failures); |
117 | 117 |
118 // WebstoreStandaloneInstaller implementation. | 118 // WebstoreStandaloneInstaller implementation. |
119 virtual void InitInstallData( | 119 void InitInstallData( |
120 extensions::ActiveInstallData* install_data) const override; | 120 extensions::ActiveInstallData* install_data) const override; |
121 virtual bool CheckRequestorAlive() const override; | 121 bool CheckRequestorAlive() const override; |
122 virtual const GURL& GetRequestorURL() const override; | 122 const GURL& GetRequestorURL() const override; |
123 virtual bool ShouldShowPostInstallUI() const override; | 123 bool ShouldShowPostInstallUI() const override; |
124 virtual bool ShouldShowAppInstalledBubble() const override; | 124 bool ShouldShowAppInstalledBubble() const override; |
125 virtual content::WebContents* GetWebContents() const override; | 125 content::WebContents* GetWebContents() const override; |
126 virtual scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt() | 126 scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt() |
127 const override; | 127 const override; |
128 virtual bool CheckInlineInstallPermitted( | 128 bool CheckInlineInstallPermitted(const base::DictionaryValue& webstore_data, |
129 const base::DictionaryValue& webstore_data, | 129 std::string* error) const override; |
130 std::string* error) const override; | 130 bool CheckRequestorPermitted(const base::DictionaryValue& webstore_data, |
131 virtual bool CheckRequestorPermitted( | 131 std::string* error) const override; |
132 const base::DictionaryValue& webstore_data, | 132 void OnManifestParsed() override; |
133 std::string* error) const override; | 133 void CompleteInstall(extensions::webstore_install::Result result, |
134 virtual void OnManifestParsed() override; | 134 const std::string& error) override; |
135 virtual void CompleteInstall(extensions::webstore_install::Result result, | |
136 const std::string& error) override; | |
137 | 135 |
138 // content::WebContentsObserver implementation. | 136 // content::WebContentsObserver implementation. |
139 virtual void WebContentsDestroyed() override; | 137 void WebContentsDestroyed() override; |
140 | 138 |
141 // ExtensionEnableFlowDelegate implementation. | 139 // ExtensionEnableFlowDelegate implementation. |
142 virtual void ExtensionEnableFlowFinished() override; | 140 void ExtensionEnableFlowFinished() override; |
143 virtual void ExtensionEnableFlowAborted(bool user_initiated) override; | 141 void ExtensionEnableFlowAborted(bool user_initiated) override; |
144 | 142 |
145 LaunchCallback launch_callback_; | 143 LaunchCallback launch_callback_; |
146 | 144 |
147 gfx::NativeWindow parent_window_; | 145 gfx::NativeWindow parent_window_; |
148 scoped_ptr<content::WebContents> dummy_web_contents_; | 146 scoped_ptr<content::WebContents> dummy_web_contents_; |
149 | 147 |
150 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; | 148 scoped_ptr<ExtensionEnableFlow> extension_enable_flow_; |
151 | 149 |
152 scoped_ptr<extensions::ExtensionInstallChecker> install_checker_; | 150 scoped_ptr<extensions::ExtensionInstallChecker> install_checker_; |
153 | 151 |
154 DISALLOW_COPY_AND_ASSIGN(EphemeralAppLauncher); | 152 DISALLOW_COPY_AND_ASSIGN(EphemeralAppLauncher); |
155 }; | 153 }; |
156 | 154 |
157 #endif // CHROME_BROWSER_APPS_EPHEMERAL_APP_LAUNCHER_H_ | 155 #endif // CHROME_BROWSER_APPS_EPHEMERAL_APP_LAUNCHER_H_ |
OLD | NEW |