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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.cc

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