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 #include "chrome/browser/ui/views/theme_install_bubble_view.h" | 5 #include "chrome/browser/ui/views/theme_install_bubble_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/common/chrome_notification_types.h" | 8 #include "chrome/common/chrome_notification_types.h" |
9 #include "content/browser/tab_contents/tab_contents.h" | 9 #include "content/browser/tab_contents/tab_contents.h" |
10 #include "content/common/notification_service.h" | 10 #include "content/common/notification_service.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // We can't check for the size of tab_contents before we've generated | 42 // We can't check for the size of tab_contents before we've generated |
43 // the string and the font that determine the size of the bubble. | 43 // the string and the font that determine the size of the bubble. |
44 tab_contents->GetContainerBounds(&tab_contents_bounds_); | 44 tab_contents->GetContainerBounds(&tab_contents_bounds_); |
45 if (tab_contents_bounds_.height() < GetPreferredSize().height()) | 45 if (tab_contents_bounds_.height() < GetPreferredSize().height()) |
46 Close(); | 46 Close(); |
47 | 47 |
48 // Close when theme has been installed. | 48 // Close when theme has been installed. |
49 registrar_.Add( | 49 registrar_.Add( |
50 this, | 50 this, |
51 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 51 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
52 NotificationService::AllSources()); | 52 NotificationService::AllBrowserContextsAndSources()); |
53 | 53 |
54 // Close when we are installing an extension, not a theme. | 54 // Close when we are installing an extension, not a theme. |
55 registrar_.Add( | 55 registrar_.Add( |
56 this, | 56 this, |
57 chrome::NOTIFICATION_NO_THEME_DETECTED, | 57 chrome::NOTIFICATION_NO_THEME_DETECTED, |
58 NotificationService::AllSources()); | 58 NotificationService::AllSources()); |
59 registrar_.Add( | 59 registrar_.Add( |
60 this, | 60 this, |
61 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 61 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
62 NotificationService::AllSources()); | 62 NotificationService::AllSources()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 const NotificationDetails& details) { | 162 const NotificationDetails& details) { |
163 Close(); | 163 Close(); |
164 } | 164 } |
165 | 165 |
166 // static | 166 // static |
167 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { | 167 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { |
168 ++num_loads_extant_; | 168 ++num_loads_extant_; |
169 if (num_loads_extant_ < 2) | 169 if (num_loads_extant_ < 2) |
170 new ThemeInstallBubbleView(tab_contents); | 170 new ThemeInstallBubbleView(tab_contents); |
171 } | 171 } |
OLD | NEW |