| OLD | NEW |
| 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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/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 "chrome/browser/ui/dialog_style.h" | 12 #include "chrome/browser/ui/dialog_style.h" |
| 13 #include "chrome/browser/ui/views/window.h" | 13 #include "chrome/browser/ui/views/window.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
| 15 #include "content/browser/tab_contents/tab_contents_view.h" | 15 #include "content/browser/tab_contents/tab_contents_view.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
| 18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/message_box_flags.h" | |
| 21 #include "ui/base/text/text_elider.h" | 20 #include "ui/base/text/text_elider.h" |
| 22 #include "ui/views/controls/message_box_view.h" | 21 #include "ui/views/controls/message_box_view.h" |
| 23 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 24 | 23 |
| 25 namespace { | 24 namespace { |
| 26 | 25 |
| 27 const int kMessageWidth = 400; | 26 const int kMessageWidth = 400; |
| 28 | 27 |
| 29 } // namespace | 28 } // namespace |
| 30 | 29 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 string16 elided_url_without_scheme; | 101 string16 elided_url_without_scheme; |
| 103 ui::ElideString(ASCIIToUTF16(url.possibly_invalid_spec()), | 102 ui::ElideString(ASCIIToUTF16(url.possibly_invalid_spec()), |
| 104 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); | 103 kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); |
| 105 | 104 |
| 106 string16 message_text = l10n_util::GetStringFUTF16( | 105 string16 message_text = l10n_util::GetStringFUTF16( |
| 107 IDS_EXTERNAL_PROTOCOL_INFORMATION, | 106 IDS_EXTERNAL_PROTOCOL_INFORMATION, |
| 108 ASCIIToUTF16(url.scheme() + ":"), | 107 ASCIIToUTF16(url.scheme() + ":"), |
| 109 elided_url_without_scheme) + ASCIIToUTF16("\n\n"); | 108 elided_url_without_scheme) + ASCIIToUTF16("\n\n"); |
| 110 | 109 |
| 111 message_box_view_ = new views::MessageBoxView( | 110 message_box_view_ = new views::MessageBoxView( |
| 112 ui::MessageBoxFlags::kIsConfirmMessageBox, | 111 views::MessageBoxView::NO_OPTIONS, |
| 113 message_text, | 112 message_text, |
| 114 string16(), | 113 string16(), |
| 115 kMessageWidth); | 114 kMessageWidth); |
| 116 message_box_view_->SetCheckBoxLabel( | 115 message_box_view_->SetCheckBoxLabel( |
| 117 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); | 116 l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)); |
| 118 | 117 |
| 119 gfx::NativeWindow parent_window; | 118 gfx::NativeWindow parent_window; |
| 120 if (tab_contents) { | 119 if (tab_contents) { |
| 121 parent_window = tab_contents->view()->GetTopLevelNativeWindow(); | 120 parent_window = tab_contents->view()->GetTopLevelNativeWindow(); |
| 122 } else { | 121 } else { |
| 123 // Dialog is top level if we don't have a tab_contents associated with us. | 122 // Dialog is top level if we don't have a tab_contents associated with us. |
| 124 parent_window = NULL; | 123 parent_window = NULL; |
| 125 } | 124 } |
| 126 browser::CreateViewsWindow(parent_window, this, STYLE_GENERIC)->Show(); | 125 browser::CreateViewsWindow(parent_window, this, STYLE_GENERIC)->Show(); |
| 127 } | 126 } |
| OLD | NEW |