OLD | NEW |
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 #include "chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/common/extensions/extension_action.h" | 24 #include "chrome/common/extensions/extension_action.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
27 #include "grit/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
29 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
32 #include "ui/gfx/gtk_util.h" | 32 #include "ui/gfx/gtk_util.h" |
33 | 33 |
| 34 using extensions::Extension; |
| 35 |
34 namespace { | 36 namespace { |
35 | 37 |
36 const int kHorizontalColumnSpacing = 10; | 38 const int kHorizontalColumnSpacing = 10; |
37 const int kIconPadding = 3; | 39 const int kIconPadding = 3; |
38 const int kIconSize = 43; | 40 const int kIconSize = 43; |
39 const int kTextColumnVerticalSpacing = 7; | 41 const int kTextColumnVerticalSpacing = 7; |
40 const int kTextColumnWidth = 350; | 42 const int kTextColumnWidth = 350; |
41 | 43 |
42 // When showing the bubble for a new browser action, we may have to wait for | 44 // When showing the bubble for a new browser action, we may have to wait for |
43 // the toolbar to finish animating to know where the item's final position | 45 // the toolbar to finish animating to know where the item's final position |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 const Extension* extension = | 110 const Extension* extension = |
109 content::Details<const Extension>(details).ptr(); | 111 content::Details<const Extension>(details).ptr(); |
110 if (extension == extension_) { | 112 if (extension == extension_) { |
111 // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. | 113 // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. |
112 MessageLoopForUI::current()->PostTask( | 114 MessageLoopForUI::current()->PostTask( |
113 FROM_HERE, | 115 FROM_HERE, |
114 base::Bind(&ExtensionInstalledBubbleGtk::ShowInternal, this)); | 116 base::Bind(&ExtensionInstalledBubbleGtk::ShowInternal, this)); |
115 } | 117 } |
116 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 118 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
117 const Extension* extension = | 119 const Extension* extension = |
118 content::Details<UnloadedExtensionInfo>(details)->extension; | 120 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; |
119 if (extension == extension_) | 121 if (extension == extension_) |
120 extension_ = NULL; | 122 extension_ = NULL; |
121 } else { | 123 } else { |
122 NOTREACHED() << L"Received unexpected notification"; | 124 NOTREACHED() << L"Received unexpected notification"; |
123 } | 125 } |
124 } | 126 } |
125 | 127 |
126 void ExtensionInstalledBubbleGtk::ShowInternal() { | 128 void ExtensionInstalledBubbleGtk::ShowInternal() { |
127 BrowserWindowGtk* browser_window = | 129 BrowserWindowGtk* browser_window = |
128 BrowserWindowGtk::GetBrowserWindowForNativeWindow( | 130 BrowserWindowGtk::GetBrowserWindowForNativeWindow( |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // on all references being cleared before it is destroyed. | 356 // on all references being cleared before it is destroyed. |
355 MessageLoopForUI::current()->PostTask( | 357 MessageLoopForUI::current()->PostTask( |
356 FROM_HERE, | 358 FROM_HERE, |
357 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); | 359 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); |
358 } | 360 } |
359 | 361 |
360 void ExtensionInstalledBubbleGtk::Close() { | 362 void ExtensionInstalledBubbleGtk::Close() { |
361 Release(); // Balanced in ctor. | 363 Release(); // Balanced in ctor. |
362 bubble_ = NULL; | 364 bubble_ = NULL; |
363 } | 365 } |
OLD | NEW |