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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.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/infobars/infobar_view.h" 5 #include "chrome/browser/ui/views/infobars/infobar_view.h"
6 6
7 #if defined(OS_WIN)
8 #include <shellapi.h>
9 #endif
10
7 #include <algorithm> 11 #include <algorithm>
8 12
9 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
10 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/infobars/infobar_delegate.h" 15 #include "chrome/browser/infobars/infobar_delegate.h"
12 #include "chrome/browser/ui/views/infobars/infobar_background.h" 16 #include "chrome/browser/ui/views/infobars/infobar_background.h"
13 #include "chrome/browser/ui/views/infobars/infobar_button_border.h" 17 #include "chrome/browser/ui/views/infobars/infobar_button_border.h"
14 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
15 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
16 #include "grit/theme_resources_standard.h" 20 #include "grit/theme_resources_standard.h"
17 #include "third_party/skia/include/effects/SkGradientShader.h" 21 #include "third_party/skia/include/effects/SkGradientShader.h"
18 #include "ui/base/accessibility/accessible_view_state.h" 22 #include "ui/base/accessibility/accessible_view_state.h"
19 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 24 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/canvas_skia_paint.h" 25 #include "ui/gfx/canvas_skia_paint.h"
22 #include "ui/gfx/image/image.h" 26 #include "ui/gfx/image/image.h"
23 #include "views/controls/button/image_button.h" 27 #include "views/controls/button/image_button.h"
24 #include "views/controls/button/menu_button.h" 28 #include "views/controls/button/menu_button.h"
25 #include "views/controls/button/text_button.h" 29 #include "views/controls/button/text_button.h"
26 #include "views/controls/image_view.h" 30 #include "views/controls/image_view.h"
27 #include "views/controls/label.h" 31 #include "views/controls/label.h"
28 #include "views/controls/link.h" 32 #include "views/controls/link.h"
29 #include "views/controls/menu/menu_model_adapter.h" 33 #include "views/controls/menu/menu_model_adapter.h"
30 #include "views/controls/menu/menu_runner.h" 34 #include "views/controls/menu/menu_runner.h"
31 #include "views/focus/external_focus_tracker.h" 35 #include "views/focus/external_focus_tracker.h"
32 #include "views/widget/widget.h" 36 #include "views/widget/widget.h"
33 #include "views/window/non_client_view.h" 37 #include "views/window/non_client_view.h"
34 38
35 #if defined(OS_WIN) 39 #if defined(OS_WIN)
36 #include <shellapi.h>
37
38 #include "base/win/win_util.h" 40 #include "base/win/win_util.h"
39 #include "base/win/windows_version.h" 41 #include "base/win/windows_version.h"
40 #include "ui/base/win/hwnd_util.h" 42 #include "ui/base/win/hwnd_util.h"
41 #include "ui/gfx/icon_util.h" 43 #include "ui/gfx/icon_util.h"
42 #endif 44 #endif
43 45
44 // static 46 // static
45 const int InfoBar::kSeparatorLineHeight = 47 const int InfoBar::kSeparatorLineHeight =
46 views::NonClientFrameView::kClientEdgeThickness; 48 views::NonClientFrameView::kClientEdgeThickness;
47 const int InfoBar::kDefaultArrowTargetHeight = 9; 49 const int InfoBar::kDefaultArrowTargetHeight = 9;
(...skipping 21 matching lines...) Expand all
69 71
70 InfoBarView::~InfoBarView() { 72 InfoBarView::~InfoBarView() {
71 // We should have closed any open menus in PlatformSpecificHide(), then 73 // We should have closed any open menus in PlatformSpecificHide(), then
72 // subclasses' RunMenu() functions should have prevented opening any new ones 74 // subclasses' RunMenu() functions should have prevented opening any new ones
73 // once we became unowned. 75 // once we became unowned.
74 DCHECK(!menu_runner_.get()); 76 DCHECK(!menu_runner_.get());
75 } 77 }
76 78
77 // static 79 // static
78 views::Label* InfoBarView::CreateLabel(const string16& text) { 80 views::Label* InfoBarView::CreateLabel(const string16& text) {
79 views::Label* label = new views::Label(UTF16ToWideHack(text), 81 views::Label* label = new views::Label(text,
80 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); 82 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
81 label->SetColor(SK_ColorBLACK); 83 label->SetColor(SK_ColorBLACK);
82 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 84 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
83 return label; 85 return label;
84 } 86 }
85 87
86 // static 88 // static
87 views::Link* InfoBarView::CreateLink(const string16& text, 89 views::Link* InfoBarView::CreateLink(const string16& text,
88 views::LinkListener* listener, 90 views::LinkListener* listener,
89 const SkColor& background_color) { 91 const SkColor& background_color) {
90 views::Link* link = new views::Link; 92 views::Link* link = new views::Link;
91 link->SetText(UTF16ToWideHack(text)); 93 link->SetText(text);
92 link->SetFont( 94 link->SetFont(
93 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); 95 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
94 link->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 96 link->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
95 link->set_listener(listener); 97 link->set_listener(listener);
96 link->MakeReadableOverBackgroundColor(background_color); 98 link->MakeReadableOverBackgroundColor(background_color);
97 return link; 99 return link;
98 } 100 }
99 101
100 // static 102 // static
101 views::MenuButton* InfoBarView::CreateMenuButton( 103 views::MenuButton* InfoBarView::CreateMenuButton(
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 377
376 void InfoBarView::FocusWillChange(View* focused_before, View* focused_now) { 378 void InfoBarView::FocusWillChange(View* focused_before, View* focused_now) {
377 // This will trigger some screen readers to read the entire contents of this 379 // This will trigger some screen readers to read the entire contents of this
378 // infobar. 380 // infobar.
379 if (focused_before && focused_now && !Contains(focused_before) && 381 if (focused_before && focused_now && !Contains(focused_before) &&
380 Contains(focused_now) && GetWidget()) { 382 Contains(focused_now) && GetWidget()) {
381 GetWidget()->NotifyAccessibilityEvent( 383 GetWidget()->NotifyAccessibilityEvent(
382 this, ui::AccessibilityTypes::EVENT_ALERT, true); 384 this, ui::AccessibilityTypes::EVENT_ALERT, true);
383 } 385 }
384 } 386 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/indexed_db_info_view.cc ('k') | chrome/browser/ui/views/instant_confirm_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698