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

Side by Side Diff: chrome/browser/chromeos/external_protocol_dialog.cc

Issue 10378086: views: Add a new ctor to MessageBoxView that takes only a InitParams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix review Created 8 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_in_progress_dialog_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/external_protocol_dialog.h" 5 #include "chrome/browser/chromeos/external_protocol_dialog.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/external_protocol/external_protocol_handler.h" 10 #include "chrome/browser/external_protocol/external_protocol_handler.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 ExternalProtocolDialog::ExternalProtocolDialog(WebContents* web_contents, 92 ExternalProtocolDialog::ExternalProtocolDialog(WebContents* web_contents,
93 const GURL& url) 93 const GURL& url)
94 : creation_time_(base::TimeTicks::Now()), 94 : creation_time_(base::TimeTicks::Now()),
95 scheme_(url.scheme()) { 95 scheme_(url.scheme()) {
96 const int kMaxUrlWithoutSchemeSize = 256; 96 const int kMaxUrlWithoutSchemeSize = 256;
97 string16 elided_url_without_scheme; 97 string16 elided_url_without_scheme;
98 ui::ElideString(ASCIIToUTF16(url.possibly_invalid_spec()), 98 ui::ElideString(ASCIIToUTF16(url.possibly_invalid_spec()),
99 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); 99 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme);
100 100
101 string16 message_text = l10n_util::GetStringFUTF16( 101 views::MessageBoxView::InitParams params(
102 IDS_EXTERNAL_PROTOCOL_INFORMATION, 102 l10n_util::GetStringFUTF16(IDS_EXTERNAL_PROTOCOL_INFORMATION,
103 ASCIIToUTF16(url.scheme() + ":"), 103 ASCIIToUTF16(url.scheme() + ":"),
104 elided_url_without_scheme) + ASCIIToUTF16("\n\n"); 104 elided_url_without_scheme) + ASCIIToUTF16("\n\n"));
105 105 params.message_width = kMessageWidth;
106 message_box_view_ = new views::MessageBoxView( 106 message_box_view_ = new views::MessageBoxView(params);
107 views::MessageBoxView::NO_OPTIONS,
108 message_text,
109 string16(),
110 kMessageWidth);
111 message_box_view_->SetCheckBoxLabel( 107 message_box_view_->SetCheckBoxLabel(
112 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); 108 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT));
113 109
114 gfx::NativeWindow parent_window; 110 gfx::NativeWindow parent_window;
115 if (web_contents) { 111 if (web_contents) {
116 parent_window = web_contents->GetView()->GetTopLevelNativeWindow(); 112 parent_window = web_contents->GetView()->GetTopLevelNativeWindow();
117 } else { 113 } else {
118 // Dialog is top level if we don't have a web_contents associated with us. 114 // Dialog is top level if we don't have a web_contents associated with us.
119 parent_window = NULL; 115 parent_window = NULL;
120 } 116 }
121 views::Widget::CreateWindowWithParent(this, parent_window)->Show(); 117 views::Widget::CreateWindowWithParent(this, parent_window)->Show();
122 } 118 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/download/download_in_progress_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698