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

Side by Side Diff: chrome/browser/ui/views/global_error_bubble_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/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(new views::Label(title_string)); 46 scoped_ptr<views::Label> title_label(
47 new views::Label(UTF16ToWideHack(title_string)));
47 title_label->SetMultiLine(true); 48 title_label->SetMultiLine(true);
48 title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 49 title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
49 title_label->SetFont(title_label->font().DeriveFont(1)); 50 title_label->SetFont(title_label->font().DeriveFont(1));
50 51
51 string16 message_string(error_->GetBubbleViewMessage()); 52 string16 message_string(error_->GetBubbleViewMessage());
52 scoped_ptr<views::Label> message_label(new views::Label(message_string)); 53 scoped_ptr<views::Label> message_label(
54 new views::Label(UTF16ToWideHack(message_string)));
53 message_label->SetMultiLine(true); 55 message_label->SetMultiLine(true);
54 message_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 56 message_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
55 57
56 string16 accept_string(error_->GetBubbleViewAcceptButtonLabel()); 58 string16 accept_string(error_->GetBubbleViewAcceptButtonLabel());
57 scoped_ptr<views::TextButton> accept_button( 59 scoped_ptr<views::TextButton> accept_button(
58 new views::NativeTextButton(this, UTF16ToWideHack(accept_string))); 60 new views::NativeTextButton(this, UTF16ToWideHack(accept_string)));
59 accept_button->SetIsDefault(true); 61 accept_button->SetIsDefault(true);
60 62
61 string16 cancel_string(error_->GetBubbleViewCancelButtonLabel()); 63 string16 cancel_string(error_->GetBubbleViewCancelButtonLabel());
62 scoped_ptr<views::TextButton> cancel_button; 64 scoped_ptr<views::TextButton> cancel_button;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 gfx::Rect bounds(origin.x(), origin.y(), wrench_button->width(), 153 gfx::Rect bounds(origin.x(), origin.y(), wrench_button->width(),
152 wrench_button->height()); 154 wrench_button->height());
153 bounds.Inset(0, kWrenchBubblePointOffsetY); 155 bounds.Inset(0, kWrenchBubblePointOffsetY);
154 156
155 GlobalErrorBubbleView* bubble_view = 157 GlobalErrorBubbleView* bubble_view =
156 new GlobalErrorBubbleView(browser, error); 158 new GlobalErrorBubbleView(browser, error);
157 // Bubble::Show() takes ownership of the view. 159 // Bubble::Show() takes ownership of the view.
158 Bubble::Show(browser_view->GetWidget(), bounds, 160 Bubble::Show(browser_view->GetWidget(), bounds,
159 views::BubbleBorder::TOP_RIGHT, bubble_view, bubble_view); 161 views::BubbleBorder::TOP_RIGHT, bubble_view, bubble_view);
160 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698