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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_installed_bubble.cc

Issue 8113031: Change std::wstring to string16 for views::Label and views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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/extensions/extension_installed_bubble.h" 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string>
8 9
9 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
10 #include "base/message_loop.h" 11 #include "base/message_loop.h"
11 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/extensions/extension_install_ui.h" 13 #include "chrome/browser/extensions/extension_install_ui.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/views/browser_actions_container.h" 17 #include "chrome/browser/ui/views/browser_actions_container.h"
17 #include "chrome/browser/ui/views/frame/browser_view.h" 18 #include "chrome/browser/ui/views/frame/browser_view.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 namespace browser { 70 namespace browser {
70 71
71 void ShowExtensionInstalledBubble( 72 void ShowExtensionInstalledBubble(
72 const Extension* extension, 73 const Extension* extension,
73 Browser* browser, 74 Browser* browser,
74 const SkBitmap& icon, 75 const SkBitmap& icon,
75 Profile* profile) { 76 Profile* profile) {
76 ExtensionInstalledBubble::Show(extension, browser, icon); 77 ExtensionInstalledBubble::Show(extension, browser, icon);
77 } 78 }
78 79
79 } // namespace browser 80 } // namespace browser
80 81
81 // InstalledBubbleContent is the content view which is placed in the 82 // InstalledBubbleContent is the content view which is placed in the
82 // ExtensionInstalledBubble. It displays the install icon and explanatory 83 // ExtensionInstalledBubble. It displays the install icon and explanatory
83 // text about the installed extension. 84 // text about the installed extension.
84 class InstalledBubbleContent : public views::View, 85 class InstalledBubbleContent : public views::View,
85 public views::ButtonListener, 86 public views::ButtonListener,
86 public views::LinkListener { 87 public views::LinkListener {
87 public: 88 public:
88 InstalledBubbleContent(Browser* browser, 89 InstalledBubbleContent(Browser* browser,
89 const Extension* extension, 90 const Extension* extension,
(...skipping 11 matching lines...) Expand all
101 gfx::Size size(icon->width(), icon->height()); 102 gfx::Size size(icon->width(), icon->height());
102 if (size.width() > kIconSize || size.height() > kIconSize) 103 if (size.width() > kIconSize || size.height() > kIconSize)
103 size = gfx::Size(kIconSize, kIconSize); 104 size = gfx::Size(kIconSize, kIconSize);
104 icon_ = new views::ImageView(); 105 icon_ = new views::ImageView();
105 icon_->SetImageSize(size); 106 icon_->SetImageSize(size);
106 icon_->SetImage(*icon); 107 icon_->SetImage(*icon);
107 AddChildView(icon_); 108 AddChildView(icon_);
108 109
109 string16 extension_name = UTF8ToUTF16(extension->name()); 110 string16 extension_name = UTF8ToUTF16(extension->name());
110 base::i18n::AdjustStringForLocaleDirection(&extension_name); 111 base::i18n::AdjustStringForLocaleDirection(&extension_name);
111 heading_ = new views::Label(UTF16ToWide( 112 heading_ = new views::Label(
112 l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING, 113 l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING,
113 extension_name))); 114 extension_name));
114 heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); 115 heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
115 heading_->SetMultiLine(true); 116 heading_->SetMultiLine(true);
116 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 117 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
117 AddChildView(heading_); 118 AddChildView(heading_);
118 119
119 switch (type_) { 120 switch (type_) {
120 case ExtensionInstalledBubble::PAGE_ACTION: { 121 case ExtensionInstalledBubble::PAGE_ACTION: {
121 info_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16( 122 info_ = new views::Label(l10n_util::GetStringUTF16(
122 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO))); 123 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO));
123 info_->SetFont(font); 124 info_->SetFont(font);
124 info_->SetMultiLine(true); 125 info_->SetMultiLine(true);
125 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 126 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
126 AddChildView(info_); 127 AddChildView(info_);
127 break; 128 break;
128 } 129 }
129 case ExtensionInstalledBubble::OMNIBOX_KEYWORD: { 130 case ExtensionInstalledBubble::OMNIBOX_KEYWORD: {
130 info_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16( 131 info_ = new views::Label(l10n_util::GetStringFUTF16(
131 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, 132 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO,
132 UTF8ToUTF16(extension->omnibox_keyword())))); 133 UTF8ToUTF16(extension->omnibox_keyword())));
133 info_->SetFont(font); 134 info_->SetFont(font);
134 info_->SetMultiLine(true); 135 info_->SetMultiLine(true);
135 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 136 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
136 AddChildView(info_); 137 AddChildView(info_);
137 break; 138 break;
138 } 139 }
139 case ExtensionInstalledBubble::APP: { 140 case ExtensionInstalledBubble::APP: {
140 views::Link* link = new views::Link(UTF16ToWide( 141 views::Link* link = new views::Link(
141 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_APP_INFO))); 142 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_APP_INFO));
142 link->set_listener(this); 143 link->set_listener(this);
143 manage_ = link; 144 manage_ = link;
144 manage_->SetFont(font); 145 manage_->SetFont(font);
145 manage_->SetMultiLine(true); 146 manage_->SetMultiLine(true);
146 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 147 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
147 AddChildView(manage_); 148 AddChildView(manage_);
148 break; 149 break;
149 } 150 }
150 default: 151 default:
151 break; 152 break;
152 } 153 }
153 154
154 if (type_ != ExtensionInstalledBubble::APP) { 155 if (type_ != ExtensionInstalledBubble::APP) {
155 manage_ = new views::Label(UTF16ToWide( 156 manage_ = new views::Label(
156 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO))); 157 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO));
157 manage_->SetFont(font); 158 manage_->SetFont(font);
158 manage_->SetMultiLine(true); 159 manage_->SetMultiLine(true);
159 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 160 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
160 AddChildView(manage_); 161 AddChildView(manage_);
161 } 162 }
162 163
163 close_button_ = new views::ImageButton(this); 164 close_button_ = new views::ImageButton(this);
164 close_button_->SetImage(views::CustomButton::BS_NORMAL, 165 close_button_->SetImage(views::CustomButton::BS_NORMAL,
165 rb.GetBitmapNamed(IDR_CLOSE_BAR)); 166 rb.GetBitmapNamed(IDR_CLOSE_BAR));
166 close_button_->SetImage(views::CustomButton::BS_HOT, 167 close_button_->SetImage(views::CustomButton::BS_HOT,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 Release(); // Balanced in ctor. 422 Release(); // Balanced in ctor.
422 } 423 }
423 424
424 bool ExtensionInstalledBubble::CloseOnEscape() { 425 bool ExtensionInstalledBubble::CloseOnEscape() {
425 return true; 426 return true;
426 } 427 }
427 428
428 bool ExtensionInstalledBubble::FadeInOnShow() { 429 bool ExtensionInstalledBubble::FadeInOnShow() {
429 return true; 430 return true;
430 } 431 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698