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

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

Issue 1575653002: [Extensions] Small cleanup of extension_install_prompt.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_install_prompt.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/compiler_specific.h"
15 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
16 #include "base/macros.h" 15 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
18 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
20 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
21 #include "extensions/common/permissions/permission_message.h" 20 #include "extensions/common/permissions/permission_message.h"
22 #include "extensions/common/url_pattern.h"
23 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
24 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
25 #include "ui/gfx/image/image_skia.h"
26 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
27 24
28 class ExtensionInstallPromptShowParams; 25 class ExtensionInstallPromptShowParams;
29 class Profile; 26 class Profile;
30 27
31 namespace base { 28 namespace base {
32 class DictionaryValue; 29 class DictionaryValue;
33 class MessageLoop; 30 class MessageLoop;
34 } // namespace base 31 } // namespace base
35 32
36 namespace content { 33 namespace content {
37 class BrowserContext; 34 class BrowserContext;
38 class WebContents; 35 class WebContents;
39 } 36 }
40 37
41 namespace extensions { 38 namespace extensions {
42 class BundleInstaller; 39 class BundleInstaller;
43 class CrxInstallError; 40 class CrxInstallError;
44 class Extension; 41 class Extension;
45 class ExtensionInstallUI; 42 class ExtensionInstallUI;
46 class ExtensionWebstorePrivateApiTest;
47 class MockGetAuthTokenFunction;
48 class PermissionSet; 43 class PermissionSet;
49 } // namespace extensions 44 } // namespace extensions
50 45
51 namespace infobars { 46 namespace gfx {
52 class InfoBarDelegate; 47 class ImageSkia;
53 } 48 }
54 49
55 // Displays all the UI around extension installation. 50 // Displays all the UI around extension installation.
56 class ExtensionInstallPrompt 51 class ExtensionInstallPrompt {
57 : public base::SupportsWeakPtr<ExtensionInstallPrompt> {
58 public: 52 public:
59 // This enum is associated with Extensions.InstallPrompt_Type UMA histogram. 53 // This enum is associated with Extensions.InstallPrompt_Type UMA histogram.
60 // Do not modify existing values and add new values only to the end. 54 // Do not modify existing values and add new values only to the end.
61 enum PromptType { 55 enum PromptType {
62 UNSET_PROMPT_TYPE = -1, 56 UNSET_PROMPT_TYPE = -1,
63 INSTALL_PROMPT = 0, 57 INSTALL_PROMPT = 0,
64 INLINE_INSTALL_PROMPT, 58 INLINE_INSTALL_PROMPT,
65 BUNDLE_INSTALL_PROMPT, 59 BUNDLE_INSTALL_PROMPT,
66 RE_ENABLE_PROMPT, 60 RE_ENABLE_PROMPT,
67 PERMISSIONS_PROMPT, 61 PERMISSIONS_PROMPT,
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 335
342 // Installation was successful. This is declared virtual for testing. 336 // Installation was successful. This is declared virtual for testing.
343 virtual void OnInstallSuccess(const extensions::Extension* extension, 337 virtual void OnInstallSuccess(const extensions::Extension* extension,
344 SkBitmap* icon); 338 SkBitmap* icon);
345 339
346 // Installation failed. This is declared virtual for testing. 340 // Installation failed. This is declared virtual for testing.
347 virtual void OnInstallFailure(const extensions::CrxInstallError& error); 341 virtual void OnInstallFailure(const extensions::CrxInstallError& error);
348 342
349 bool did_call_show_dialog() const { return did_call_show_dialog_; } 343 bool did_call_show_dialog() const { return did_call_show_dialog_; }
350 344
351 protected:
352 friend class extensions::ExtensionWebstorePrivateApiTest;
353 friend class WebstoreStartupInstallUnpackFailureTest;
354
355 private: 345 private:
356 friend class GalleryInstallApiTestObserver;
357
358 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains 346 // Sets the icon that will be used in any UI. If |icon| is NULL, or contains
359 // an empty bitmap, then a default icon will be used instead. 347 // an empty bitmap, then a default icon will be used instead.
360 void SetIcon(const SkBitmap* icon); 348 void SetIcon(const SkBitmap* icon);
361 349
362 // ImageLoader callback. 350 // ImageLoader callback.
363 void OnImageLoaded(const gfx::Image& image); 351 void OnImageLoaded(const gfx::Image& image);
364 352
365 // Starts the process of showing a confirmation UI, which is split into two. 353 // Starts the process of showing a confirmation UI, which is split into two.
366 // 1) Set off a 'load icon' task. 354 // 1) Set off a 'load icon' task.
367 // 2) Handle the load icon response and show the UI (OnImageLoaded). 355 // 2) Handle the load icon response and show the UI (OnImageLoaded).
(...skipping 28 matching lines...) Expand all
396 384
397 // A pre-filled prompt. 385 // A pre-filled prompt.
398 scoped_ptr<Prompt> prompt_; 386 scoped_ptr<Prompt> prompt_;
399 387
400 // Used to show the confirm dialog. 388 // Used to show the confirm dialog.
401 ShowDialogCallback show_dialog_callback_; 389 ShowDialogCallback show_dialog_callback_;
402 390
403 // Whether or not the |show_dialog_callback_| was called. 391 // Whether or not the |show_dialog_callback_| was called.
404 bool did_call_show_dialog_; 392 bool did_call_show_dialog_;
405 393
394 base::WeakPtrFactory<ExtensionInstallPrompt> weak_factory_;
395
406 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPrompt); 396 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPrompt);
407 }; 397 };
408 398
409 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ 399 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_install_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698