OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/theme_install_bubble_view.h" | 5 #include "chrome/browser/views/theme_install_bubble_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
10 #include "gfx/canvas_skia.h" | 10 #include "gfx/canvas_skia.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 ThemeInstallBubbleView::~ThemeInstallBubbleView() { | 85 ThemeInstallBubbleView::~ThemeInstallBubbleView() { |
86 num_loads_extant_ = 0; | 86 num_loads_extant_ = 0; |
87 } | 87 } |
88 | 88 |
89 gfx::Size ThemeInstallBubbleView::GetPreferredSize() { | 89 gfx::Size ThemeInstallBubbleView::GetPreferredSize() { |
90 return gfx::Size(views::Label::font().GetStringWidth(text_) + | 90 return gfx::Size(views::Label::font().GetStringWidth(text_) + |
91 kTextHorizPadding, | 91 kTextHorizPadding, |
92 ResourceBundle::GetSharedInstance().GetFont( | 92 ResourceBundle::GetSharedInstance().GetFont( |
93 ResourceBundle::LargeFont).height() + kTextVertPadding); | 93 ResourceBundle::LargeFont).GetHeight() + kTextVertPadding); |
94 } | 94 } |
95 | 95 |
96 void ThemeInstallBubbleView::Reposition() { | 96 void ThemeInstallBubbleView::Reposition() { |
97 if (!popup_) | 97 if (!popup_) |
98 Close(); | 98 Close(); |
99 | 99 |
100 gfx::Size size = GetPreferredSize(); | 100 gfx::Size size = GetPreferredSize(); |
101 int mid_x = tab_contents_bounds_.x() + | 101 int mid_x = tab_contents_bounds_.x() + |
102 (tab_contents_bounds_.right() - tab_contents_bounds_.x()) / 2; | 102 (tab_contents_bounds_.right() - tab_contents_bounds_.x()) / 2; |
103 | 103 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 Close(); | 156 Close(); |
157 } | 157 } |
158 | 158 |
159 // static | 159 // static |
160 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { | 160 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { |
161 ++num_loads_extant_; | 161 ++num_loads_extant_; |
162 if (num_loads_extant_ < 2) | 162 if (num_loads_extant_ < 2) |
163 new ThemeInstallBubbleView(tab_contents); | 163 new ThemeInstallBubbleView(tab_contents); |
164 } | 164 } |
165 | 165 |
OLD | NEW |