OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ui/app_modal_dialogs/message_box_handler.h" | 5 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/message_box_flags.h" | 8 #include "app/message_box_flags.h" |
9 #include "app/text_elider.h" | 9 #include "app/text_elider.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/extensions/extensions_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
16 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 16 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
17 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" | 17 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "gfx/font.h" | 20 #include "gfx/font.h" |
21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
24 | 24 |
25 static std::wstring GetTitle(Profile* profile, | 25 static std::wstring GetTitle(Profile* profile, |
26 bool is_alert, | 26 bool is_alert, |
27 const GURL& frame_url) { | 27 const GURL& frame_url) { |
28 ExtensionsService* extensions_service = profile->GetExtensionsService(); | 28 ExtensionService* extensions_service = profile->GetExtensionService(); |
29 if (extensions_service) { | 29 if (extensions_service) { |
30 const Extension* extension = | 30 const Extension* extension = |
31 extensions_service->GetExtensionByURL(frame_url); | 31 extensions_service->GetExtensionByURL(frame_url); |
32 if (!extension) | 32 if (!extension) |
33 extension = extensions_service->GetExtensionByWebExtent(frame_url); | 33 extension = extensions_service->GetExtensionByWebExtent(frame_url); |
34 | 34 |
35 if (extension && (extension->location() == Extension::COMPONENT)) { | 35 if (extension && (extension->location() == Extension::COMPONENT)) { |
36 return l10n_util::GetString(IDS_PRODUCT_NAME); | 36 return l10n_util::GetString(IDS_PRODUCT_NAME); |
37 } else if (extension && !extension->name().empty()) { | 37 } else if (extension && !extension->name().empty()) { |
38 return UTF8ToWide(extension->name()); | 38 return UTF8ToWide(extension->name()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const std::wstring& message_text, | 79 const std::wstring& message_text, |
80 IPC::Message* reply_msg) { | 80 IPC::Message* reply_msg) { |
81 std::wstring full_message = | 81 std::wstring full_message = |
82 message_text + L"\n\n" + | 82 message_text + L"\n\n" + |
83 l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER); | 83 l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER); |
84 AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog( | 84 AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog( |
85 tab_contents, l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE), | 85 tab_contents, l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE), |
86 MessageBoxFlags::kIsJavascriptConfirm, message_text, std::wstring(), | 86 MessageBoxFlags::kIsJavascriptConfirm, message_text, std::wstring(), |
87 false, true, reply_msg)); | 87 false, true, reply_msg)); |
88 } | 88 } |
OLD | NEW |