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

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

Issue 6257006: Move a bunch of random other files to src/ui/base... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | « chrome/browser/browser_main_gtk.cc ('k') | chrome/browser/chromeos/frame/panel_browser_view.h » ('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) 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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/message_box_flags.h"
9 #include "app/text_elider.h"
10 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
11 #include "base/string_util.h" 9 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/external_protocol_handler.h" 11 #include "chrome/browser/external_protocol_handler.h"
14 #include "chrome/browser/tab_contents/tab_contents.h" 12 #include "chrome/browser/tab_contents/tab_contents.h"
15 #include "chrome/browser/tab_contents/tab_contents_view.h" 13 #include "chrome/browser/tab_contents/tab_contents_view.h"
16 #include "chrome/browser/tab_contents/tab_util.h" 14 #include "chrome/browser/tab_contents/tab_util.h"
17 #include "chrome/browser/ui/views/window.h" 15 #include "chrome/browser/ui/views/window.h"
18 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
19 #include "grit/chromium_strings.h" 17 #include "grit/chromium_strings.h"
20 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "ui/base/message_box_flags.h"
20 #include "ui/base/text/text_elider.h"
21 #include "views/controls/message_box_view.h" 21 #include "views/controls/message_box_view.h"
22 #include "views/window/window.h" 22 #include "views/window/window.h"
23 23
24 namespace { 24 namespace {
25 25
26 const int kMessageWidth = 400; 26 const int kMessageWidth = 400;
27 27
28 } // namespace 28 } // namespace
29 29
30 /////////////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////////////
(...skipping 11 matching lines...) Expand all
42 /////////////////////////////////////////////////////////////////////////////// 42 ///////////////////////////////////////////////////////////////////////////////
43 // ExternalProtocolDialog 43 // ExternalProtocolDialog
44 44
45 ExternalProtocolDialog::~ExternalProtocolDialog() { 45 ExternalProtocolDialog::~ExternalProtocolDialog() {
46 } 46 }
47 47
48 ////////////////////////////////////////////////////////////////////////////// 48 //////////////////////////////////////////////////////////////////////////////
49 // ExternalProtocolDialog, views::DialogDelegate implementation: 49 // ExternalProtocolDialog, views::DialogDelegate implementation:
50 50
51 int ExternalProtocolDialog::GetDialogButtons() const { 51 int ExternalProtocolDialog::GetDialogButtons() const {
52 return MessageBoxFlags::DIALOGBUTTON_OK; 52 return ui::MessageBoxFlags::DIALOGBUTTON_OK;
53 } 53 }
54 54
55 std::wstring ExternalProtocolDialog::GetDialogButtonLabel( 55 std::wstring ExternalProtocolDialog::GetDialogButtonLabel(
56 MessageBoxFlags::DialogButton button) const { 56 ui::MessageBoxFlags::DialogButton button) const {
57 return UTF16ToWide( 57 return UTF16ToWide(
58 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT)); 58 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT));
59 } 59 }
60 60
61 std::wstring ExternalProtocolDialog::GetWindowTitle() const { 61 std::wstring ExternalProtocolDialog::GetWindowTitle() const {
62 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_TITLE)); 62 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_TITLE));
63 } 63 }
64 64
65 void ExternalProtocolDialog::DeleteDelegate() { 65 void ExternalProtocolDialog::DeleteDelegate() {
66 delete this; 66 delete this;
(...skipping 14 matching lines...) Expand all
81 81
82 /////////////////////////////////////////////////////////////////////////////// 82 ///////////////////////////////////////////////////////////////////////////////
83 // ExternalProtocolDialog, private: 83 // ExternalProtocolDialog, private:
84 84
85 ExternalProtocolDialog::ExternalProtocolDialog(TabContents* tab_contents, 85 ExternalProtocolDialog::ExternalProtocolDialog(TabContents* tab_contents,
86 const GURL& url) 86 const GURL& url)
87 : creation_time_(base::TimeTicks::Now()), 87 : creation_time_(base::TimeTicks::Now()),
88 scheme_(url.scheme()) { 88 scheme_(url.scheme()) {
89 const int kMaxUrlWithoutSchemeSize = 256; 89 const int kMaxUrlWithoutSchemeSize = 256;
90 std::wstring elided_url_without_scheme; 90 std::wstring elided_url_without_scheme;
91 gfx::ElideString(ASCIIToWide(url.possibly_invalid_spec()), 91 ui::ElideString(ASCIIToWide(url.possibly_invalid_spec()),
92 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); 92 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme);
93 93
94 std::wstring message_text = UTF16ToWide(l10n_util::GetStringFUTF16( 94 std::wstring message_text = UTF16ToWide(l10n_util::GetStringFUTF16(
95 IDS_EXTERNAL_PROTOCOL_INFORMATION, 95 IDS_EXTERNAL_PROTOCOL_INFORMATION,
96 ASCIIToUTF16(url.scheme() + ":"), 96 ASCIIToUTF16(url.scheme() + ":"),
97 WideToUTF16(elided_url_without_scheme)) + ASCIIToUTF16("\n\n")); 97 WideToUTF16(elided_url_without_scheme)) + ASCIIToUTF16("\n\n"));
98 98
99 message_box_view_ = new MessageBoxView(MessageBoxFlags::kIsConfirmMessageBox, 99 message_box_view_ = new MessageBoxView(
100 message_text, 100 ui::MessageBoxFlags::kIsConfirmMessageBox,
101 std::wstring(), 101 message_text,
102 kMessageWidth); 102 std::wstring(),
103 kMessageWidth);
103 message_box_view_->SetCheckBoxLabel(UTF16ToWide( 104 message_box_view_->SetCheckBoxLabel(UTF16ToWide(
104 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT))); 105 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)));
105 106
106 gfx::NativeWindow parent_window; 107 gfx::NativeWindow parent_window;
107 if (tab_contents) { 108 if (tab_contents) {
108 parent_window = tab_contents->view()->GetTopLevelNativeWindow(); 109 parent_window = tab_contents->view()->GetTopLevelNativeWindow();
109 } else { 110 } else {
110 // Dialog is top level if we don't have a tab_contents associated with us. 111 // Dialog is top level if we don't have a tab_contents associated with us.
111 parent_window = NULL; 112 parent_window = NULL;
112 } 113 }
113 browser::CreateViewsWindow(parent_window, gfx::Rect(), this)->Show(); 114 browser::CreateViewsWindow(parent_window, gfx::Rect(), this)->Show();
114 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main_gtk.cc ('k') | chrome/browser/chromeos/frame/panel_browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698