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

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

Issue 10699057: Move application creation and extension install prompt showing off Browser and onto ExtensionTabHel… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
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_EXTENSION_INSTALL_PROMPT_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_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/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "chrome/browser/extensions/crx_installer_error.h" 15 #include "chrome/browser/extensions/crx_installer_error.h"
16 #include "chrome/browser/extensions/image_loading_tracker.h" 16 #include "chrome/browser/extensions/image_loading_tracker.h"
17 #include "chrome/common/extensions/url_pattern.h" 17 #include "chrome/common/extensions/url_pattern.h"
18 #include "chrome/common/net/gaia/oauth2_mint_token_flow.h" 18 #include "chrome/common/net/gaia/oauth2_mint_token_flow.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
20 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
21 #include "ui/gfx/image/image_skia.h" 21 #include "ui/gfx/image/image_skia.h"
22 #include "ui/gfx/native_widget_types.h" 22 #include "ui/gfx/native_widget_types.h"
23 23
24 class Browser; 24 class Browser;
25 class ExtensionInstallUI; 25 class ExtensionInstallUI;
26 class InfoBarDelegate;
26 class MessageLoop; 27 class MessageLoop;
27 class InfoBarDelegate; 28 class Profile;
28 29
29 namespace base { 30 namespace base {
30 class DictionaryValue; 31 class DictionaryValue;
31 } // namespace base 32 } // namespace base
32 33
34 namespace content {
35 class PageNavigator;
36 }
37
33 namespace extensions { 38 namespace extensions {
34 class BundleInstaller; 39 class BundleInstaller;
35 class Extension; 40 class Extension;
36 class ExtensionWebstorePrivateApiTest; 41 class ExtensionWebstorePrivateApiTest;
37 class PermissionSet; 42 class PermissionSet;
38 } // namespace extensions 43 } // namespace extensions
39 44
40 // Displays all the UI around extension installation. 45 // Displays all the UI around extension installation.
41 class ExtensionInstallPrompt : public ImageLoadingTracker::Observer, 46 class ExtensionInstallPrompt : public ImageLoadingTracker::Observer,
42 public OAuth2MintTokenFlow::Delegate { 47 public OAuth2MintTokenFlow::Delegate {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 157
153 // Creates a dummy extension from the |manifest|, replacing the name and 158 // Creates a dummy extension from the |manifest|, replacing the name and
154 // description with the localizations if provided. 159 // description with the localizations if provided.
155 static scoped_refptr<extensions::Extension> GetLocalizedExtensionForDisplay( 160 static scoped_refptr<extensions::Extension> GetLocalizedExtensionForDisplay(
156 const base::DictionaryValue* manifest, 161 const base::DictionaryValue* manifest,
157 const std::string& id, 162 const std::string& id,
158 const std::string& localized_name, 163 const std::string& localized_name,
159 const std::string& localized_description, 164 const std::string& localized_description,
160 std::string* error); 165 std::string* error);
161 166
162 explicit ExtensionInstallPrompt(Browser* browser); 167 // Creates a prompt with a parent window and a navigator that can be used to
168 // load pages.
169 ExtensionInstallPrompt(gfx::NativeWindow parent,
170 content::PageNavigator* navigator,
171 Profile* profile);
163 virtual ~ExtensionInstallPrompt(); 172 virtual ~ExtensionInstallPrompt();
164 173
165 ExtensionInstallUI* install_ui() const { return install_ui_.get(); } 174 ExtensionInstallUI* install_ui() const { return install_ui_.get(); }
166 175
167 bool record_oauth2_grant() const { return record_oauth2_grant_; } 176 bool record_oauth2_grant() const { return record_oauth2_grant_; }
168 177
169 // This is called by the bundle installer to verify whether the bundle 178 // This is called by the bundle installer to verify whether the bundle
170 // should be installed. 179 // should be installed.
171 // 180 //
172 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. 181 // We *MUST* eventually call either Proceed() or Abort() on |delegate|.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 263
255 // OAuth2MintTokenFlow::Delegate implementation: 264 // OAuth2MintTokenFlow::Delegate implementation:
256 virtual void OnIssueAdviceSuccess( 265 virtual void OnIssueAdviceSuccess(
257 const IssueAdviceInfo& issue_advice) OVERRIDE; 266 const IssueAdviceInfo& issue_advice) OVERRIDE;
258 virtual void OnMintTokenFailure( 267 virtual void OnMintTokenFailure(
259 const GoogleServiceAuthError& error) OVERRIDE; 268 const GoogleServiceAuthError& error) OVERRIDE;
260 269
261 // Shows the actual UI (the icon should already be loaded). 270 // Shows the actual UI (the icon should already be loaded).
262 void ShowConfirmation(); 271 void ShowConfirmation();
263 272
264 Browser* browser_; 273 gfx::NativeWindow parent_;
274 content::PageNavigator* navigator_;
265 MessageLoop* ui_loop_; 275 MessageLoop* ui_loop_;
266 276
267 // The extensions installation icon. 277 // The extensions installation icon.
268 SkBitmap icon_; 278 SkBitmap icon_;
269 279
270 // The extension we are showing the UI for. 280 // The extension we are showing the UI for.
271 const extensions::Extension* extension_; 281 const extensions::Extension* extension_;
272 282
273 // The bundle we are showing the UI for, if type BUNDLE_INSTALL_PROMPT. 283 // The bundle we are showing the UI for, if type BUNDLE_INSTALL_PROMPT.
274 const extensions::BundleInstaller* bundle_; 284 const extensions::BundleInstaller* bundle_;
(...skipping 13 matching lines...) Expand all
288 // The type of prompt we are going to show. 298 // The type of prompt we are going to show.
289 PromptType prompt_type_; 299 PromptType prompt_type_;
290 300
291 scoped_ptr<OAuth2MintTokenFlow> token_flow_; 301 scoped_ptr<OAuth2MintTokenFlow> token_flow_;
292 302
293 // Keeps track of extension images being loaded on the File thread for the 303 // Keeps track of extension images being loaded on the File thread for the
294 // purpose of showing the install UI. 304 // purpose of showing the install UI.
295 ImageLoadingTracker tracker_; 305 ImageLoadingTracker tracker_;
296 }; 306 };
297 307
308 namespace chrome {
309
310 // Creates an ExtensionInstallPrompt from |browser|. Caller assumes ownership.
311 // TODO(beng): remove this once various extensions types are weaned from
312 // Browser.
313 ExtensionInstallPrompt* CreateExtensionInstallPromptWithBrowser(
314 Browser* browser);
315
316 } // namespace chrome
317
298 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 318 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698