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

Side by Side Diff: chrome/browser/ui/views/ime/ime_warning_bubble_view.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase (conflict in layout_delegate.h due to r457774) Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ime/ime_warning_bubble_view.h" 5 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h" 10 #include "chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h"
11 #include "chrome/browser/platform_util.h" 11 #include "chrome/browser/platform_util.h"
12 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
13 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
14 #include "chrome/browser/ui/views/harmony/chrome_typography.h"
14 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" 15 #include "chrome/browser/ui/views/toolbar/app_menu_button.h"
15 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" 16 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
16 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 17 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
17 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
18 #include "extensions/common/feature_switch.h" 19 #include "extensions/common/feature_switch.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 21 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/views/controls/button/checkbox.h" 22 #include "ui/views/controls/button/checkbox.h"
22 #include "ui/views/layout/layout_constants.h" 23 #include "ui/views/layout/layout_constants.h"
23 24
24 using extensions::Extension; 25 using extensions::Extension;
25 26
26 namespace { 27 namespace {
27 28
28 // The column width of the warning bubble. 29 // The column width of the warning bubble.
29 const int kColumnWidth = 285; 30 const int kColumnWidth = 285;
30 31
31 views::Label* CreateLabel(const base::string16& text, 32 views::Label* CreateExtensionNameLabel(const base::string16& text) {
32 const gfx::FontList& font) { 33 views::Label* label = new views::Label(text, CONTEXT_BODY_TEXT_SMALL);
33 views::Label* label = new views::Label(text, font);
34 label->SetMultiLine(true); 34 label->SetMultiLine(true);
35 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 35 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
36 return label; 36 return label;
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 // static 41 // static
42 void ImeWarningBubbleView::ShowBubble( 42 void ImeWarningBubbleView::ShowBubble(
43 const extensions::Extension* extension, 43 const extensions::Extension* extension,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 views::GridLayout* layout = new views::GridLayout(this); 165 views::GridLayout* layout = new views::GridLayout(this);
166 SetLayoutManager(layout); 166 SetLayoutManager(layout);
167 167
168 int cs_id = 0; 168 int cs_id = 0;
169 169
170 views::ColumnSet* main_cs = layout->AddColumnSet(cs_id); 170 views::ColumnSet* main_cs = layout->AddColumnSet(cs_id);
171 // The first row which shows the warning info. 171 // The first row which shows the warning info.
172 main_cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0, 172 main_cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0,
173 views::GridLayout::FIXED, kColumnWidth, 0); 173 views::GridLayout::FIXED, kColumnWidth, 0);
174 174
175 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
176 layout->StartRow(0, cs_id); 175 layout->StartRow(0, cs_id);
177 base::string16 extension_name = base::UTF8ToUTF16(extension_->name()); 176 base::string16 extension_name = base::UTF8ToUTF16(extension_->name());
178 base::i18n::AdjustStringForLocaleDirection(&extension_name); 177 base::i18n::AdjustStringForLocaleDirection(&extension_name);
179 views::Label* warning = CreateLabel( 178 views::Label* warning = CreateExtensionNameLabel(l10n_util::GetStringFUTF16(
180 l10n_util::GetStringFUTF16(IDS_IME_API_ACTIVATED_WARNING, extension_name), 179 IDS_IME_API_ACTIVATED_WARNING, extension_name));
181 rb.GetFontList(ResourceBundle::BaseFont));
182 layout->AddView(warning); 180 layout->AddView(warning);
183 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 181 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
184 182
185 // The seconde row which shows the check box. 183 // The seconde row which shows the check box.
186 layout->StartRow(0, cs_id); 184 layout->StartRow(0, cs_id);
187 never_show_checkbox_ = 185 never_show_checkbox_ =
188 new views::Checkbox(l10n_util::GetStringUTF16(IDS_IME_API_NEVER_SHOW)); 186 new views::Checkbox(l10n_util::GetStringUTF16(IDS_IME_API_NEVER_SHOW));
189 layout->AddView(never_show_checkbox_); 187 layout->AddView(never_show_checkbox_);
190 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 188 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
191 } 189 }
192 190
193 bool ImeWarningBubbleView::IsToolbarAnimating() { 191 bool ImeWarningBubbleView::IsToolbarAnimating() {
194 return anchor_to_browser_action_ && container_->animating(); 192 return anchor_to_browser_action_ && container_->animating();
195 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698