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

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

Issue 23731010: Move text_elider to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update3 Created 7 years, 3 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 | « ash/system/user/tray_user.cc ('k') | chrome/browser/download/download_item_model.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/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/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 "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_contents_view.h" 13 #include "content/public/browser/web_contents_view.h"
14 #include "grit/chromium_strings.h" 14 #include "grit/chromium_strings.h"
15 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/text/text_elider.h" 17 #include "ui/gfx/text_elider.h"
18 #include "ui/views/controls/message_box_view.h" 18 #include "ui/views/controls/message_box_view.h"
19 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 using content::WebContents; 22 using content::WebContents;
23 23
24 namespace { 24 namespace {
25 25
26 const int kMessageWidth = 400; 26 const int kMessageWidth = 400;
27 27
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 /////////////////////////////////////////////////////////////////////////////// 89 ///////////////////////////////////////////////////////////////////////////////
90 // ExternalProtocolDialog, private: 90 // ExternalProtocolDialog, private:
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 gfx::ElideString(ASCIIToUTF16(url.possibly_invalid_spec()),
99 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); 99 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme);
100 100
101 views::MessageBoxView::InitParams params( 101 views::MessageBoxView::InitParams params(
102 l10n_util::GetStringFUTF16(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 params.message_width = kMessageWidth; 105 params.message_width = kMessageWidth;
106 message_box_view_ = new views::MessageBoxView(params); 106 message_box_view_ = new views::MessageBoxView(params);
107 message_box_view_->SetCheckBoxLabel( 107 message_box_view_->SetCheckBoxLabel(
108 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); 108 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT));
109 109
110 gfx::NativeWindow parent_window; 110 gfx::NativeWindow parent_window;
111 if (web_contents) { 111 if (web_contents) {
112 parent_window = web_contents->GetView()->GetTopLevelNativeWindow(); 112 parent_window = web_contents->GetView()->GetTopLevelNativeWindow();
113 } else { 113 } else {
114 // 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.
115 parent_window = NULL; 115 parent_window = NULL;
116 } 116 }
117 views::DialogDelegate::CreateDialogWidget(this, NULL, parent_window)->Show(); 117 views::DialogDelegate::CreateDialogWidget(this, NULL, parent_window)->Show();
118 } 118 }
OLDNEW
« no previous file with comments | « ash/system/user/tray_user.cc ('k') | chrome/browser/download/download_item_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698