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_CHROMEOS_FILE_MANAGER_FILE_MANAGER_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_APP_INSTALLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_INSTALLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_APP_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" |
11 #include "chrome/browser/extensions/webstore_standalone_installer.h" | 11 #include "chrome/browser/extensions/webstore_standalone_installer.h" |
12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 namespace file_manager { | 18 namespace file_manager { |
19 | 19 |
20 // Installer for Files.app. | 20 // This class is used for installing apps and extensions suggested from the |
21 class FileManagerInstaller | 21 // Chrome Web Store for unsupported file types, inside Files.app. |
| 22 class AppInstaller |
22 : public extensions::WebstoreStandaloneInstaller { | 23 : public extensions::WebstoreStandaloneInstaller { |
23 public: | 24 public: |
24 typedef extensions::WebstoreStandaloneInstaller::Callback Callback; | 25 typedef extensions::WebstoreStandaloneInstaller::Callback Callback; |
25 | 26 |
26 FileManagerInstaller(content::WebContents* web_contents, | 27 AppInstaller(content::WebContents* web_contents, |
27 const std::string& webstore_item_id, | 28 const std::string& webstore_item_id, |
28 Profile* profile, | 29 Profile* profile, |
29 const Callback& callback); | 30 const Callback& callback); |
30 | 31 |
31 protected: | 32 protected: |
32 friend class base::RefCountedThreadSafe<FileManagerInstaller>; | 33 friend class base::RefCountedThreadSafe<AppInstaller>; |
33 | 34 |
34 virtual ~FileManagerInstaller(); | 35 virtual ~AppInstaller(); |
35 | 36 |
36 void OnWebContentsDestroyed(content::WebContents* web_contents); | 37 void OnWebContentsDestroyed(content::WebContents* web_contents); |
37 | 38 |
38 // WebstoreStandaloneInstaller implementation. | 39 // WebstoreStandaloneInstaller implementation. |
39 virtual bool CheckRequestorAlive() const OVERRIDE; | 40 virtual bool CheckRequestorAlive() const OVERRIDE; |
40 virtual const GURL& GetRequestorURL() const OVERRIDE; | 41 virtual const GURL& GetRequestorURL() const OVERRIDE; |
41 virtual bool ShouldShowPostInstallUI() const OVERRIDE; | 42 virtual bool ShouldShowPostInstallUI() const OVERRIDE; |
42 virtual bool ShouldShowAppInstalledBubble() const OVERRIDE; | 43 virtual bool ShouldShowAppInstalledBubble() const OVERRIDE; |
43 virtual content::WebContents* GetWebContents() const OVERRIDE; | 44 virtual content::WebContents* GetWebContents() const OVERRIDE; |
44 virtual scoped_ptr<ExtensionInstallPrompt::Prompt> | 45 virtual scoped_ptr<ExtensionInstallPrompt::Prompt> |
45 CreateInstallPrompt() const OVERRIDE; | 46 CreateInstallPrompt() const OVERRIDE; |
46 virtual bool CheckInlineInstallPermitted( | 47 virtual bool CheckInlineInstallPermitted( |
47 const base::DictionaryValue& webstore_data, | 48 const base::DictionaryValue& webstore_data, |
48 std::string* error) const OVERRIDE; | 49 std::string* error) const OVERRIDE; |
49 virtual bool CheckRequestorPermitted( | 50 virtual bool CheckRequestorPermitted( |
50 const base::DictionaryValue& webstore_data, | 51 const base::DictionaryValue& webstore_data, |
51 std::string* error) const OVERRIDE; | 52 std::string* error) const OVERRIDE; |
52 | 53 |
53 private: | 54 private: |
54 class WebContentsObserver; | 55 class WebContentsObserver; |
55 | 56 |
56 Callback callback_; | 57 Callback callback_; |
57 content::WebContents* web_contents_; | 58 content::WebContents* web_contents_; |
58 scoped_ptr<WebContentsObserver> web_contents_observer_; | 59 scoped_ptr<WebContentsObserver> web_contents_observer_; |
59 | 60 |
60 DISALLOW_IMPLICIT_CONSTRUCTORS(FileManagerInstaller); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(AppInstaller); |
61 }; | 62 }; |
62 | 63 |
63 } // namespace file_manager | 64 } // namespace file_manager |
64 | 65 |
65 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_INSTALLER_H_ | 66 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_APP_INSTALLER_H_ |
OLD | NEW |