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_EXTENSION_INSTALL_UI_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "chrome/browser/extensions/image_loading_tracker.h" | 13 #include "chrome/browser/extensions/image_loading_tracker.h" |
14 #include "chrome/common/extensions/url_pattern.h" | 14 #include "chrome/common/extensions/url_pattern.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 | 17 |
| 18 class Browser; |
18 class Extension; | 19 class Extension; |
19 class ExtensionPermissionSet; | 20 class ExtensionPermissionSet; |
20 class MessageLoop; | 21 class MessageLoop; |
21 class Profile; | 22 class Profile; |
22 class InfoBarDelegate; | 23 class InfoBarDelegate; |
23 class TabContents; | 24 class TabContents; |
24 | 25 |
25 // Displays all the UI around extension installation and uninstallation. | 26 // Displays all the UI around extension installation and uninstallation. |
26 class ExtensionInstallUI : public ImageLoadingTracker::Observer { | 27 class ExtensionInstallUI : public ImageLoadingTracker::Observer { |
27 public: | 28 public: |
(...skipping 21 matching lines...) Expand all Loading... |
49 // |user_initiated| true if the installation was stopped by the user. | 50 // |user_initiated| true if the installation was stopped by the user. |
50 virtual void InstallUIAbort(bool user_initiated) = 0; | 51 virtual void InstallUIAbort(bool user_initiated) = 0; |
51 | 52 |
52 protected: | 53 protected: |
53 virtual ~Delegate() {} | 54 virtual ~Delegate() {} |
54 }; | 55 }; |
55 | 56 |
56 explicit ExtensionInstallUI(Profile* profile); | 57 explicit ExtensionInstallUI(Profile* profile); |
57 virtual ~ExtensionInstallUI(); | 58 virtual ~ExtensionInstallUI(); |
58 | 59 |
| 60 // TODO(asargent) Normally we navigate to the new tab page when an app is |
| 61 // installed, but we're experimenting with instead showing a bubble when |
| 62 // an app is installed which points to the new tab button. This may become |
| 63 // the default behavior in the future. |
| 64 void set_use_app_installed_bubble(bool use_bubble) { |
| 65 use_app_installed_bubble_ = use_bubble; |
| 66 } |
| 67 |
59 // This is called by the installer to verify whether the installation should | 68 // This is called by the installer to verify whether the installation should |
60 // proceed. This is declared virtual for testing. | 69 // proceed. This is declared virtual for testing. |
61 // | 70 // |
62 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 71 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
63 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension); | 72 virtual void ConfirmInstall(Delegate* delegate, const Extension* extension); |
64 | 73 |
65 // This is called by the app handler launcher to verify whether the app | 74 // This is called by the app handler launcher to verify whether the app |
66 // should be re-enabled. This is declared virtual for testing. | 75 // should be re-enabled. This is declared virtual for testing. |
67 // | 76 // |
68 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 77 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
(...skipping 10 matching lines...) Expand all Loading... |
79 // Installation was successful. This is declared virtual for testing. | 88 // Installation was successful. This is declared virtual for testing. |
80 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon); | 89 virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon); |
81 | 90 |
82 // Installation failed. This is declared virtual for testing. | 91 // Installation failed. This is declared virtual for testing. |
83 virtual void OnInstallFailure(const std::string& error); | 92 virtual void OnInstallFailure(const std::string& error); |
84 | 93 |
85 // ImageLoadingTracker::Observer: | 94 // ImageLoadingTracker::Observer: |
86 virtual void OnImageLoaded( | 95 virtual void OnImageLoaded( |
87 SkBitmap* image, const ExtensionResource& resource, int index); | 96 SkBitmap* image, const ExtensionResource& resource, int index); |
88 | 97 |
| 98 // Opens a new tab page and animates the app icon for the app with id |
| 99 // |app_id|. |
| 100 static void OpenAppInstalledNTP(Browser* browser, const std::string& app_id); |
| 101 |
89 protected: | 102 protected: |
90 friend class ExtensionWebstorePrivateApiTest; | 103 friend class ExtensionWebstorePrivateApiTest; |
91 | 104 |
92 // Disables showing UI (ErrorBox, etc.) for install failures. To be used only | 105 // Disables showing UI (ErrorBox, etc.) for install failures. To be used only |
93 // in tests. | 106 // in tests. |
94 static void DisableFailureUIForTests(); | 107 static void DisableFailureUIForTests(); |
95 | 108 |
96 private: | 109 private: |
97 friend class GalleryInstallApiTestObserver; | 110 friend class GalleryInstallApiTestObserver; |
98 | 111 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 151 |
139 // The delegate we will call Proceed/Abort on after confirmation UI. | 152 // The delegate we will call Proceed/Abort on after confirmation UI. |
140 Delegate* delegate_; | 153 Delegate* delegate_; |
141 | 154 |
142 // The type of prompt we are going to show. | 155 // The type of prompt we are going to show. |
143 PromptType prompt_type_; | 156 PromptType prompt_type_; |
144 | 157 |
145 // Keeps track of extension images being loaded on the File thread for the | 158 // Keeps track of extension images being loaded on the File thread for the |
146 // purpose of showing the install UI. | 159 // purpose of showing the install UI. |
147 ImageLoadingTracker tracker_; | 160 ImageLoadingTracker tracker_; |
| 161 |
| 162 // Whether to show an installed bubble on app install, or use the default |
| 163 // action of opening a new tab page. |
| 164 bool use_app_installed_bubble_; |
148 }; | 165 }; |
149 | 166 |
150 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ | 167 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_UI_H_ |
OLD | NEW |