| 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_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/ui/views/bubble/bubble.h" | 10 #include "chrome/browser/ui/views/bubble/bubble.h" |
| 11 #include "content/common/notification_observer.h" | 11 #include "content/common/notification_observer.h" |
| 12 #include "content/common/notification_registrar.h" | 12 #include "content/common/notification_registrar.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 | 14 |
| 15 class Browser; | 15 class Browser; |
| 16 class Extension; | 16 class Extension; |
| 17 class InstalledBubbleContent; | 17 class InstalledBubbleContent; |
| 18 class SkBitmap; | 18 class SkBitmap; |
| 19 | 19 |
| 20 // Provides feedback to the user upon successful installation of an | 20 // Provides feedback to the user upon successful installation of an |
| 21 // extension. Depending on the type of extension, the Bubble will | 21 // extension. Depending on the type of extension, the Bubble will |
| 22 // point to: | 22 // point to: |
| 23 // OMNIBOX_KEYWORD-> The omnibox. | 23 // OMNIBOX_KEYWORD-> The omnibox. |
| 24 // BROWSER_ACTION -> The browserAction icon in the toolbar. | 24 // BROWSER_ACTION -> The browserAction icon in the toolbar. |
| 25 // PAGE_ACTION -> A preview of the pageAction icon in the location | 25 // PAGE_ACTION -> A preview of the pageAction icon in the location |
| 26 // bar which is shown while the Bubble is shown. | 26 // bar which is shown while the Bubble is shown. |
| 27 // APP -> The plus button in the tabstrip (for the New Tab Page). |
| 27 // GENERIC -> The wrench menu. This case includes pageActions that | 28 // GENERIC -> The wrench menu. This case includes pageActions that |
| 28 // don't specify a default icon. | 29 // don't specify a default icon. |
| 29 // | 30 // |
| 30 // ExtensionInstallBubble manages its own lifetime. | 31 // ExtensionInstallBubble manages its own lifetime. |
| 31 class ExtensionInstalledBubble | 32 class ExtensionInstalledBubble |
| 32 : public BubbleDelegate, | 33 : public BubbleDelegate, |
| 33 public NotificationObserver, | 34 public NotificationObserver, |
| 34 public base::RefCountedThreadSafe<ExtensionInstalledBubble> { | 35 public base::RefCountedThreadSafe<ExtensionInstalledBubble> { |
| 35 public: | 36 public: |
| 36 // The behavior and content of this Bubble comes in these varieties: | 37 // The behavior and content of this Bubble comes in these varieties: |
| 37 enum BubbleType { | 38 enum BubbleType { |
| 38 OMNIBOX_KEYWORD, | 39 OMNIBOX_KEYWORD, |
| 39 BROWSER_ACTION, | 40 BROWSER_ACTION, |
| 40 PAGE_ACTION, | 41 PAGE_ACTION, |
| 42 APP, |
| 41 GENERIC | 43 GENERIC |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 // Creates the ExtensionInstalledBubble and schedules it to be shown once | 46 // Creates the ExtensionInstalledBubble and schedules it to be shown once |
| 45 // the extension has loaded. |extension| is the installed extension. |browser| | 47 // the extension has loaded. |extension| is the installed extension. |browser| |
| 46 // is the browser window which will host the bubble. |icon| is the install | 48 // is the browser window which will host the bubble. |icon| is the install |
| 47 // icon of the extension. | 49 // icon of the extension. |
| 48 static void Show( | 50 static void Show( |
| 49 const Extension* extension, Browser *browser, const SkBitmap& icon); | 51 const Extension* extension, Browser *browser, const SkBitmap& icon); |
| 50 | 52 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 77 InstalledBubbleContent* bubble_content_; | 79 InstalledBubbleContent* bubble_content_; |
| 78 BubbleType type_; | 80 BubbleType type_; |
| 79 | 81 |
| 80 // How many times we've deferred due to animations being in progress. | 82 // How many times we've deferred due to animations being in progress. |
| 81 int animation_wait_retries_; | 83 int animation_wait_retries_; |
| 82 | 84 |
| 83 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble); | 85 DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubble); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ | 88 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_H_ |
| OLD | NEW |