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

Side by Side Diff: components/app_modal/javascript_dialog_manager.cc

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 years, 4 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
« no previous file with comments | « components/app_modal/DEPS ('k') | components/bookmarks.gypi » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/app_modal/javascript_dialog_manager.h" 5 #include "components/app_modal/javascript_dialog_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/app_modal/app_modal_dialog.h" 10 #include "components/app_modal/app_modal_dialog.h"
11 #include "components/app_modal/app_modal_dialog_queue.h" 11 #include "components/app_modal/app_modal_dialog_queue.h"
12 #include "components/app_modal/javascript_dialog_extensions_client.h" 12 #include "components/app_modal/javascript_dialog_extensions_client.h"
13 #include "components/app_modal/javascript_native_dialog_factory.h" 13 #include "components/app_modal/javascript_native_dialog_factory.h"
14 #include "components/app_modal/native_app_modal_dialog.h" 14 #include "components/app_modal/native_app_modal_dialog.h"
15 #include "components/url_formatter/url_formatter.h"
15 #include "content/public/common/javascript_message_type.h" 16 #include "content/public/common/javascript_message_type.h"
16 #include "grit/components_strings.h" 17 #include "grit/components_strings.h"
17 #include "net/base/net_util.h" 18 #include "net/base/net_util.h"
18 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
19 20
20 namespace app_modal { 21 namespace app_modal {
21 namespace { 22 namespace {
22 23
23 class DefaultExtensionsClient : public JavaScriptDialogExtensionsClient { 24 class DefaultExtensionsClient : public JavaScriptDialogExtensionsClient {
24 public: 25 public:
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 203 }
203 204
204 // For extensions, show the extension name, but only if the origin of 205 // For extensions, show the extension name, but only if the origin of
205 // the alert matches the top-level WebContents. 206 // the alert matches the top-level WebContents.
206 std::string name; 207 std::string name;
207 if (extensions_client_->GetExtensionName(web_contents, origin_url, &name)) 208 if (extensions_client_->GetExtensionName(web_contents, origin_url, &name))
208 return base::UTF8ToUTF16(name); 209 return base::UTF8ToUTF16(name);
209 210
210 // Otherwise, return the formatted URL. 211 // Otherwise, return the formatted URL.
211 // In this case, force URL to have LTR directionality. 212 // In this case, force URL to have LTR directionality.
212 base::string16 url_string = net::FormatUrl(origin_url, accept_lang); 213 base::string16 url_string = url_formatter::FormatUrl(origin_url, accept_lang);
213 return l10n_util::GetStringFUTF16( 214 return l10n_util::GetStringFUTF16(
214 is_alert ? IDS_JAVASCRIPT_ALERT_TITLE 215 is_alert ? IDS_JAVASCRIPT_ALERT_TITLE
215 : IDS_JAVASCRIPT_MESSAGEBOX_TITLE, 216 : IDS_JAVASCRIPT_MESSAGEBOX_TITLE,
216 base::i18n::GetDisplayStringInLTRDirectionality(url_string)); 217 base::i18n::GetDisplayStringInLTRDirectionality(url_string));
217 } 218 }
218 219
219 void JavaScriptDialogManager::CancelActiveAndPendingDialogs( 220 void JavaScriptDialogManager::CancelActiveAndPendingDialogs(
220 content::WebContents* web_contents) { 221 content::WebContents* web_contents) {
221 AppModalDialogQueue* queue = AppModalDialogQueue::GetInstance(); 222 AppModalDialogQueue* queue = AppModalDialogQueue::GetInstance();
222 AppModalDialog* active_dialog = queue->active_dialog(); 223 AppModalDialog* active_dialog = queue->active_dialog();
(...skipping 17 matching lines...) Expand all
240 const base::string16& user_input) { 241 const base::string16& user_input) {
241 // If an extension opened this dialog then the extension may shut down its 242 // If an extension opened this dialog then the extension may shut down its
242 // lazy background page after the dialog closes. (Dialogs are closed before 243 // lazy background page after the dialog closes. (Dialogs are closed before
243 // their WebContents is destroyed so |web_contents| is still valid here.) 244 // their WebContents is destroyed so |web_contents| is still valid here.)
244 extensions_client_->OnDialogClosed(web_contents); 245 extensions_client_->OnDialogClosed(web_contents);
245 246
246 callback.Run(success, user_input); 247 callback.Run(success, user_input);
247 } 248 }
248 249
249 } // namespace app_modal 250 } // namespace app_modal
OLDNEW
« no previous file with comments | « components/app_modal/DEPS ('k') | components/bookmarks.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698