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

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

Issue 8553001: views: Add an Options enum to MessageBoxView control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 9 years 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/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"
11 #include "chrome/browser/tab_contents/tab_util.h" 11 #include "chrome/browser/tab_contents/tab_util.h"
12 #include "chrome/browser/ui/views/window.h" 12 #include "chrome/browser/ui/views/window.h"
13 #include "content/browser/tab_contents/tab_contents.h" 13 #include "content/browser/tab_contents/tab_contents.h"
14 #include "content/browser/tab_contents/tab_contents_view.h" 14 #include "content/browser/tab_contents/tab_contents_view.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "grit/chromium_strings.h" 16 #include "grit/chromium_strings.h"
17 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/message_box_flags.h"
20 #include "ui/base/text/text_elider.h" 19 #include "ui/base/text/text_elider.h"
21 #include "ui/views/widget/widget.h" 20 #include "ui/views/widget/widget.h"
22 #include "views/controls/message_box_view.h" 21 #include "views/controls/message_box_view.h"
23 22
24 namespace { 23 namespace {
25 24
26 const int kMessageWidth = 400; 25 const int kMessageWidth = 400;
27 26
28 } // namespace 27 } // namespace
29 28
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 string16 elided_url_without_scheme; 100 string16 elided_url_without_scheme;
102 ui::ElideString(ASCIIToUTF16(url.possibly_invalid_spec()), 101 ui::ElideString(ASCIIToUTF16(url.possibly_invalid_spec()),
103 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); 102 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme);
104 103
105 string16 message_text = l10n_util::GetStringFUTF16( 104 string16 message_text = l10n_util::GetStringFUTF16(
106 IDS_EXTERNAL_PROTOCOL_INFORMATION, 105 IDS_EXTERNAL_PROTOCOL_INFORMATION,
107 ASCIIToUTF16(url.scheme() + ":"), 106 ASCIIToUTF16(url.scheme() + ":"),
108 elided_url_without_scheme) + ASCIIToUTF16("\n\n"); 107 elided_url_without_scheme) + ASCIIToUTF16("\n\n");
109 108
110 message_box_view_ = new views::MessageBoxView( 109 message_box_view_ = new views::MessageBoxView(
111 ui::MessageBoxFlags::kIsConfirmMessageBox, 110 views::MessageBoxView::NONE,
112 message_text, 111 message_text,
113 string16(), 112 string16(),
114 kMessageWidth); 113 kMessageWidth);
115 message_box_view_->SetCheckBoxLabel( 114 message_box_view_->SetCheckBoxLabel(
116 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); 115 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT));
117 116
118 gfx::NativeWindow parent_window; 117 gfx::NativeWindow parent_window;
119 if (tab_contents) { 118 if (tab_contents) {
120 parent_window = tab_contents->view()->GetTopLevelNativeWindow(); 119 parent_window = tab_contents->view()->GetTopLevelNativeWindow();
121 } else { 120 } else {
122 // Dialog is top level if we don't have a tab_contents associated with us. 121 // Dialog is top level if we don't have a tab_contents associated with us.
123 parent_window = NULL; 122 parent_window = NULL;
124 } 123 }
125 browser::CreateViewsWindow(parent_window, this)->Show(); 124 browser::CreateViewsWindow(parent_window, this)->Show();
126 } 125 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/tab_contents/web_contents_unittest.cc » ('j') | ui/base/message_box_flags.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698