| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // Otherwise, return the formatted URL. For non-standard URLs such as |data:|, | 260 // Otherwise, return the formatted URL. For non-standard URLs such as |data:|, |
| 261 // just say "This page". | 261 // just say "This page". |
| 262 bool is_same_origin_as_main_frame = | 262 bool is_same_origin_as_main_frame = |
| 263 (web_contents->GetURL().GetOrigin() == origin_url.GetOrigin()); | 263 (web_contents->GetURL().GetOrigin() == origin_url.GetOrigin()); |
| 264 if (origin_url.IsStandard() && !origin_url.SchemeIsFile() && | 264 if (origin_url.IsStandard() && !origin_url.SchemeIsFile() && |
| 265 !origin_url.SchemeIsFileSystem()) { | 265 !origin_url.SchemeIsFileSystem()) { |
| 266 #if !defined(OS_ANDROID) | 266 #if !defined(OS_ANDROID) |
| 267 base::string16 url_string = | 267 base::string16 url_string = |
| 268 url_formatter::ElideHost(origin_url, gfx::FontList(), kUrlElideWidth); | 268 url_formatter::ElideHost(origin_url, gfx::FontList(), kUrlElideWidth); |
| 269 #else | 269 #else |
| 270 base::string16 url_string = | 270 base::string16 url_string = url_formatter::FormatUrlForSecurityDisplay( |
| 271 url_formatter::FormatUrlForSecurityDisplayOmitScheme(origin_url); | 271 origin_url, url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS); |
| 272 #endif | 272 #endif |
| 273 return l10n_util::GetStringFUTF16( | 273 return l10n_util::GetStringFUTF16( |
| 274 is_same_origin_as_main_frame ? IDS_JAVASCRIPT_MESSAGEBOX_TITLE | 274 is_same_origin_as_main_frame ? IDS_JAVASCRIPT_MESSAGEBOX_TITLE |
| 275 : IDS_JAVASCRIPT_MESSAGEBOX_TITLE_IFRAME, | 275 : IDS_JAVASCRIPT_MESSAGEBOX_TITLE_IFRAME, |
| 276 base::i18n::GetDisplayStringInLTRDirectionality(url_string)); | 276 base::i18n::GetDisplayStringInLTRDirectionality(url_string)); |
| 277 } | 277 } |
| 278 return l10n_util::GetStringUTF16( | 278 return l10n_util::GetStringUTF16( |
| 279 is_same_origin_as_main_frame | 279 is_same_origin_as_main_frame |
| 280 ? IDS_JAVASCRIPT_MESSAGEBOX_TITLE_NONSTANDARD_URL | 280 ? IDS_JAVASCRIPT_MESSAGEBOX_TITLE_NONSTANDARD_URL |
| 281 : IDS_JAVASCRIPT_MESSAGEBOX_TITLE_NONSTANDARD_URL_IFRAME); | 281 : IDS_JAVASCRIPT_MESSAGEBOX_TITLE_NONSTANDARD_URL_IFRAME); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // lazy background page after the dialog closes. (Dialogs are closed before | 325 // lazy background page after the dialog closes. (Dialogs are closed before |
| 326 // their WebContents is destroyed so |web_contents| is still valid here.) | 326 // their WebContents is destroyed so |web_contents| is still valid here.) |
| 327 extensions_client_->OnDialogClosed(web_contents); | 327 extensions_client_->OnDialogClosed(web_contents); |
| 328 | 328 |
| 329 last_close_time_ = base::TimeTicks::Now(); | 329 last_close_time_ = base::TimeTicks::Now(); |
| 330 | 330 |
| 331 callback.Run(success, user_input); | 331 callback.Run(success, user_input); |
| 332 } | 332 } |
| 333 | 333 |
| 334 } // namespace app_modal | 334 } // namespace app_modal |
| OLD | NEW |