| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
| 6 #include "app/resource_bundle.h" | 6 #include "app/resource_bundle.h" |
| 7 #include "chrome/browser/views/theme_install_bubble_view.h" | 7 #include "chrome/browser/views/theme_install_bubble_view.h" |
| 8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 // The roundedness of the edges of our bubble. | 12 // The roundedness of the edges of our bubble. |
| 13 static const int kBubbleCornerRadius = 4; | 13 static const int kBubbleCornerRadius = 4; |
| 14 | 14 |
| 15 // Padding around text in popup box. | 15 // Padding around text in popup box. |
| 16 static const int kTextHorizPadding = 90; | 16 static const int kTextHorizPadding = 90; |
| 17 static const int kTextVertPadding = 45; | 17 static const int kTextVertPadding = 45; |
| 18 | 18 |
| 19 // Multiple loads can be started at once. Only show one bubble, and keep | 19 // Multiple loads can be started at once. Only show one bubble, and keep |
| 20 // track of number of loads happening. Close bubble when num_loads < 1. | 20 // track of number of loads happening. Close bubble when num_loads < 1. |
| 21 static int num_loads_extant_ = 0; | 21 static int num_loads_extant_ = 0; |
| 22 | 22 |
| 23 } | 23 } |
| 24 | 24 |
| 25 ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents) | 25 ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents) |
| 26 : popup_(NULL) { | 26 : popup_(NULL) { |
| 27 if (!tab_contents) | 27 if (!tab_contents) |
| 28 Close(); | 28 Close(); |
| 29 | 29 |
| 30 // Need our own copy of the "Loading..." string: http://crbug.com/24177 | 30 text_ = l10n_util::GetStringUTF16(IDS_THEME_LOADING_TITLE); |
| 31 text_ = l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE); | |
| 32 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 31 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 33 gfx::Font font(rb.GetFont(ResourceBundle::LargeFont)); | 32 gfx::Font font(rb.GetFont(ResourceBundle::LargeFont)); |
| 34 SetFont(font); | 33 SetFont(font); |
| 35 | 34 |
| 36 // We can't check for the size of tab_contents before we've generated | 35 // We can't check for the size of tab_contents before we've generated |
| 37 // the string and the font that determine the size of the bubble. | 36 // the string and the font that determine the size of the bubble. |
| 38 tab_contents->GetContainerBounds(&tab_contents_bounds_); | 37 tab_contents->GetContainerBounds(&tab_contents_bounds_); |
| 39 if (tab_contents_bounds_.height() < GetPreferredSize().height()) | 38 if (tab_contents_bounds_.height() < GetPreferredSize().height()) |
| 40 Close(); | 39 Close(); |
| 41 | 40 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 Close(); | 157 Close(); |
| 159 } | 158 } |
| 160 | 159 |
| 161 // static | 160 // static |
| 162 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { | 161 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { |
| 163 ++num_loads_extant_; | 162 ++num_loads_extant_; |
| 164 if (num_loads_extant_ < 2) | 163 if (num_loads_extant_ < 2) |
| 165 new ThemeInstallBubbleView(tab_contents); | 164 new ThemeInstallBubbleView(tab_contents); |
| 166 } | 165 } |
| 167 | 166 |
| OLD | NEW |