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

Side by Side Diff: chrome/browser/ui/views/theme_install_bubble_view.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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) 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 "content/browser/tab_contents/tab_contents.h" 9 #include "content/browser/tab_contents/tab_contents.h"
9 #include "content/common/notification_service.h" 10 #include "content/common/notification_service.h"
10 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/gfx/canvas_skia.h" 14 #include "ui/gfx/canvas_skia.h"
14 #include "views/widget/widget.h" 15 #include "views/widget/widget.h"
15 16
16 namespace { 17 namespace {
17 18
(...skipping 22 matching lines...) Expand all
40 41
41 // 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
42 // 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.
43 tab_contents->GetContainerBounds(&tab_contents_bounds_); 44 tab_contents->GetContainerBounds(&tab_contents_bounds_);
44 if (tab_contents_bounds_.height() < GetPreferredSize().height()) 45 if (tab_contents_bounds_.height() < GetPreferredSize().height())
45 Close(); 46 Close();
46 47
47 // Close when theme has been installed. 48 // Close when theme has been installed.
48 registrar_.Add( 49 registrar_.Add(
49 this, 50 this,
50 NotificationType::BROWSER_THEME_CHANGED, 51 chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
51 NotificationService::AllSources()); 52 NotificationService::AllSources());
52 53
53 // Close when we are installing an extension, not a theme. 54 // Close when we are installing an extension, not a theme.
54 registrar_.Add( 55 registrar_.Add(
55 this, 56 this,
56 NotificationType::NO_THEME_DETECTED, 57 chrome::NOTIFICATION_NO_THEME_DETECTED,
57 NotificationService::AllSources()); 58 NotificationService::AllSources());
58 registrar_.Add( 59 registrar_.Add(
59 this, 60 this,
60 NotificationType::EXTENSION_INSTALLED, 61 chrome::NOTIFICATION_EXTENSION_INSTALLED,
61 NotificationService::AllSources()); 62 NotificationService::AllSources());
62 registrar_.Add( 63 registrar_.Add(
63 this, 64 this,
64 NotificationType::EXTENSION_INSTALL_ERROR, 65 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
65 NotificationService::AllSources()); 66 NotificationService::AllSources());
66 67
67 // Don't let the bubble overlap the confirm dialog. 68 // Don't let the bubble overlap the confirm dialog.
68 registrar_.Add( 69 registrar_.Add(
69 this, 70 this,
70 NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, 71 chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG,
71 NotificationService::AllSources()); 72 NotificationService::AllSources());
72 73
73 popup_ = new views::Widget; 74 popup_ = new views::Widget;
74 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 75 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
75 params.transparent = true; 76 params.transparent = true;
76 params.accept_events = false; 77 params.accept_events = false;
77 params.parent = tab_contents->GetNativeView(); 78 params.parent = tab_contents->GetNativeView();
78 popup_->Init(params); 79 popup_->Init(params);
79 popup_->SetContentsView(this); 80 popup_->SetContentsView(this);
80 popup_->SetOpacity(0xCC); 81 popup_->SetOpacity(0xCC);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (!popup_) { 150 if (!popup_) {
150 num_loads_extant_ = 0; 151 num_loads_extant_ = 0;
151 return; 152 return;
152 } 153 }
153 if (num_loads_extant_ < 1) { 154 if (num_loads_extant_ < 1) {
154 registrar_.RemoveAll(); 155 registrar_.RemoveAll();
155 popup_->Close(); 156 popup_->Close();
156 } 157 }
157 } 158 }
158 159
159 void ThemeInstallBubbleView::Observe(NotificationType type, 160 void ThemeInstallBubbleView::Observe(int type,
160 const NotificationSource& source, 161 const NotificationSource& source,
161 const NotificationDetails& details) { 162 const NotificationDetails& details) {
162 Close(); 163 Close();
163 } 164 }
164 165
165 // static 166 // static
166 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { 167 void ThemeInstallBubbleView::Show(TabContents* tab_contents) {
167 ++num_loads_extant_; 168 ++num_loads_extant_;
168 if (num_loads_extant_ < 2) 169 if (num_loads_extant_ < 2)
169 new ThemeInstallBubbleView(tab_contents); 170 new ThemeInstallBubbleView(tab_contents);
170 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/theme_install_bubble_view.h ('k') | chrome/browser/ui/views/toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698