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

Side by Side Diff: chrome/browser/ui/views/global_error_bubble_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/global_error_bubble_view.h" 5 #include "chrome/browser/ui/views/global_error_bubble_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/ui/global_error.h" 8 #include "chrome/browser/ui/global_error.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "chrome/browser/ui/views/toolbar_view.h" 10 #include "chrome/browser/ui/views/toolbar_view.h"
(...skipping 13 matching lines...) Expand all
24 }; 24 };
25 25
26 const int kBubbleViewWidth = 262; 26 const int kBubbleViewWidth = 262;
27 27
28 // The horizontal padding between the title and the icon. 28 // The horizontal padding between the title and the icon.
29 const int kTitleHorizontalPadding = 3; 29 const int kTitleHorizontalPadding = 3;
30 30
31 // The vertical offset of the wrench bubble from the wrench menu button. 31 // The vertical offset of the wrench bubble from the wrench menu button.
32 const int kWrenchBubblePointOffsetY = 6; 32 const int kWrenchBubblePointOffsetY = 6;
33 33
34 } // namespace 34 } // namespace
35 35
36 GlobalErrorBubbleView::GlobalErrorBubbleView(Browser* browser, 36 GlobalErrorBubbleView::GlobalErrorBubbleView(Browser* browser,
37 GlobalError* error) 37 GlobalError* error)
38 : browser_(browser), 38 : browser_(browser),
39 error_(error) { 39 error_(error) {
40 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 40 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
41 int resource_id = error_->GetBubbleViewIconResourceID(); 41 int resource_id = error_->GetBubbleViewIconResourceID();
42 scoped_ptr<views::ImageView> image_view(new views::ImageView()); 42 scoped_ptr<views::ImageView> image_view(new views::ImageView());
43 image_view->SetImage(rb.GetImageNamed(resource_id).ToSkBitmap()); 43 image_view->SetImage(rb.GetImageNamed(resource_id).ToSkBitmap());
44 44
45 string16 title_string(error_->GetBubbleViewTitle()); 45 string16 title_string(error_->GetBubbleViewTitle());
46 scoped_ptr<views::Label> title_label( 46 scoped_ptr<views::Label> title_label(new views::Label(title_string));
47 new views::Label(UTF16ToWideHack(title_string)));
48 title_label->SetMultiLine(true); 47 title_label->SetMultiLine(true);
49 title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 48 title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
50 title_label->SetFont(title_label->font().DeriveFont(1)); 49 title_label->SetFont(title_label->font().DeriveFont(1));
51 50
52 string16 message_string(error_->GetBubbleViewMessage()); 51 string16 message_string(error_->GetBubbleViewMessage());
53 scoped_ptr<views::Label> message_label( 52 scoped_ptr<views::Label> message_label(new views::Label(message_string));
54 new views::Label(UTF16ToWideHack(message_string)));
55 message_label->SetMultiLine(true); 53 message_label->SetMultiLine(true);
56 message_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 54 message_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
57 55
58 string16 accept_string(error_->GetBubbleViewAcceptButtonLabel()); 56 string16 accept_string(error_->GetBubbleViewAcceptButtonLabel());
59 scoped_ptr<views::TextButton> accept_button( 57 scoped_ptr<views::TextButton> accept_button(
60 new views::NativeTextButton(this, UTF16ToWideHack(accept_string))); 58 new views::NativeTextButton(this, UTF16ToWideHack(accept_string)));
61 accept_button->SetIsDefault(true); 59 accept_button->SetIsDefault(true);
62 60
63 string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); 61 string16 cancel_string(error_->GetBubbleViewCancelButtonLabel());
64 scoped_ptr<views::TextButton> cancel_button; 62 scoped_ptr<views::TextButton> cancel_button;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 gfx::Rect bounds(origin.x(), origin.y(), wrench_button->width(), 151 gfx::Rect bounds(origin.x(), origin.y(), wrench_button->width(),
154 wrench_button->height()); 152 wrench_button->height());
155 bounds.Inset(0, kWrenchBubblePointOffsetY); 153 bounds.Inset(0, kWrenchBubblePointOffsetY);
156 154
157 GlobalErrorBubbleView* bubble_view = 155 GlobalErrorBubbleView* bubble_view =
158 new GlobalErrorBubbleView(browser, error); 156 new GlobalErrorBubbleView(browser, error);
159 // Bubble::Show() takes ownership of the view. 157 // Bubble::Show() takes ownership of the view.
160 Bubble::Show(browser_view->GetWidget(), bounds, 158 Bubble::Show(browser_view->GetWidget(), bounds,
161 views::BubbleBorder::TOP_RIGHT, bubble_view, bubble_view); 159 views::BubbleBorder::TOP_RIGHT, bubble_view, bubble_view);
162 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698