| 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/ui/views/repost_form_warning_view.h" | 5 #include "chrome/browser/ui/views/repost_form_warning_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/repost_form_warning_controller.h" | 8 #include "chrome/browser/repost_form_warning_controller.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 12 #include "chrome/browser/ui/views/constrained_window_views.h" | 12 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 13 #include "content/browser/tab_contents/navigation_controller.h" | 13 #include "content/browser/tab_contents/navigation_controller.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.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/message_box_flags.h" | |
| 18 #include "ui/views/controls/message_box_view.h" | 17 #include "ui/views/controls/message_box_view.h" |
| 19 | 18 |
| 20 namespace browser { | 19 namespace browser { |
| 21 | 20 |
| 22 // Declared in browser_dialogs.h so others don't have to depend on our header. | 21 // Declared in browser_dialogs.h so others don't have to depend on our header. |
| 23 void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window, | 22 void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window, |
| 24 TabContents* tab_contents) { | 23 TabContents* tab_contents) { |
| 25 new RepostFormWarningView(parent_window, tab_contents); | 24 new RepostFormWarningView(parent_window, tab_contents); |
| 26 } | 25 } |
| 27 | 26 |
| 28 } // namespace browser | 27 } // namespace browser |
| 29 | 28 |
| 30 ////////////////////////////////////////////////////////////////////////////// | 29 ////////////////////////////////////////////////////////////////////////////// |
| 31 // RepostFormWarningView, constructor & destructor: | 30 // RepostFormWarningView, constructor & destructor: |
| 32 | 31 |
| 33 RepostFormWarningView::RepostFormWarningView( | 32 RepostFormWarningView::RepostFormWarningView( |
| 34 gfx::NativeWindow parent_window, | 33 gfx::NativeWindow parent_window, |
| 35 TabContents* tab_contents) | 34 TabContents* tab_contents) |
| 36 : controller_(new RepostFormWarningController(tab_contents)), | 35 : controller_(new RepostFormWarningController(tab_contents)), |
| 37 message_box_view_(NULL) { | 36 message_box_view_(NULL) { |
| 38 message_box_view_ = new views::MessageBoxView( | 37 message_box_view_ = new views::MessageBoxView( |
| 39 ui::MessageBoxFlags::kIsConfirmMessageBox, | 38 views::MessageBoxView::NO_OPTIONS, |
| 40 l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING), | 39 l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING), |
| 41 string16()); | 40 string16()); |
| 42 TabContentsWrapper* wrapper = | 41 TabContentsWrapper* wrapper = |
| 43 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 42 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 44 controller_->set_window(new ConstrainedWindowViews(wrapper, this)); | 43 controller_->set_window(new ConstrainedWindowViews(wrapper, this)); |
| 45 } | 44 } |
| 46 | 45 |
| 47 RepostFormWarningView::~RepostFormWarningView() { | 46 RepostFormWarningView::~RepostFormWarningView() { |
| 48 } | 47 } |
| 49 | 48 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 controller_->Continue(); | 83 controller_->Continue(); |
| 85 return true; | 84 return true; |
| 86 } | 85 } |
| 87 | 86 |
| 88 /////////////////////////////////////////////////////////////////////////////// | 87 /////////////////////////////////////////////////////////////////////////////// |
| 89 // RepostFormWarningView, RepostFormWarning implementation: | 88 // RepostFormWarningView, RepostFormWarning implementation: |
| 90 | 89 |
| 91 void RepostFormWarningView::DeleteDelegate() { | 90 void RepostFormWarningView::DeleteDelegate() { |
| 92 delete this; | 91 delete this; |
| 93 } | 92 } |
| OLD | NEW |