| 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 "chrome/common/notification_service.h" |
| 10 #include "gfx/canvas_skia.h" | 11 #include "gfx/canvas_skia.h" |
| 11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 12 #include "views/widget/widget.h" | 13 #include "views/widget/widget.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // The roundedness of the edges of our bubble. | 17 // The roundedness of the edges of our bubble. |
| 17 static const int kBubbleCornerRadius = 4; | 18 static const int kBubbleCornerRadius = 4; |
| 18 | 19 |
| 19 // Padding around text in popup box. | 20 // Padding around text in popup box. |
| 20 static const int kTextHorizPadding = 90; | 21 static const int kTextHorizPadding = 90; |
| 21 static const int kTextVertPadding = 45; | 22 static const int kTextVertPadding = 45; |
| 22 | 23 |
| 23 // Multiple loads can be started at once. Only show one bubble, and keep | 24 // Multiple loads can be started at once. Only show one bubble, and keep |
| 24 // track of number of loads happening. Close bubble when num_loads < 1. | 25 // track of number of loads happening. Close bubble when num_loads < 1. |
| 25 static int num_loads_extant_ = 0; | 26 static int num_loads_extant_ = 0; |
| 26 | 27 |
| 27 } | 28 } // namespace |
| 28 | 29 |
| 29 ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents) | 30 ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents) |
| 30 : popup_(NULL) { | 31 : popup_(NULL) { |
| 31 if (!tab_contents) | 32 if (!tab_contents) |
| 32 Close(); | 33 Close(); |
| 33 | 34 |
| 34 text_ = l10n_util::GetString(IDS_THEME_LOADING_TITLE); | 35 text_ = l10n_util::GetString(IDS_THEME_LOADING_TITLE); |
| 35 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 36 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 36 gfx::Font font(rb.GetFont(ResourceBundle::LargeFont)); | 37 gfx::Font font(rb.GetFont(ResourceBundle::LargeFont)); |
| 37 SetFont(font); | 38 SetFont(font); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 const NotificationDetails& details) { | 156 const NotificationDetails& details) { |
| 156 Close(); | 157 Close(); |
| 157 } | 158 } |
| 158 | 159 |
| 159 // static | 160 // static |
| 160 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { | 161 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { |
| 161 ++num_loads_extant_; | 162 ++num_loads_extant_; |
| 162 if (num_loads_extant_ < 2) | 163 if (num_loads_extant_ < 2) |
| 163 new ThemeInstallBubbleView(tab_contents); | 164 new ThemeInstallBubbleView(tab_contents); |
| 164 } | 165 } |
| 165 | |
| OLD | NEW |