OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/repost_form_warning_view.h" | 5 #include "chrome/browser/views/repost_form_warning_view.h" |
6 | 6 |
7 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
8 #include "chrome/browser/tab_contents/navigation_controller.h" | 8 #include "chrome/browser/tab_contents/navigation_controller.h" |
9 #include "chrome/common/l10n_util.h" | 9 #include "chrome/common/l10n_util.h" |
| 10 #include "chrome/common/message_box_flags.h" |
10 #include "chrome/common/notification_service.h" | 11 #include "chrome/common/notification_service.h" |
11 #include "chrome/views/controls/message_box_view.h" | 12 #include "chrome/views/controls/message_box_view.h" |
12 #include "chrome/views/window/window.h" | 13 #include "chrome/views/window/window.h" |
13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
14 | 15 |
15 // Implementation of function declared in | 16 // Implementation of function declared in |
16 // browser/tab_contents/repost_form_warning.h | 17 // browser/tab_contents/repost_form_warning.h |
17 void RunRepostFormWarningDialog(NavigationController* navigation_controller) { | 18 void RunRepostFormWarningDialog(NavigationController* navigation_controller) { |
18 RepostFormWarningView* dialog = | 19 RepostFormWarningView* dialog = |
19 new RepostFormWarningView(navigation_controller); | 20 new RepostFormWarningView(navigation_controller); |
20 } | 21 } |
21 | 22 |
22 RepostFormWarningView::RepostFormWarningView( | 23 RepostFormWarningView::RepostFormWarningView( |
23 NavigationController* navigation_controller) | 24 NavigationController* navigation_controller) |
24 : navigation_controller_(navigation_controller), | 25 : navigation_controller_(navigation_controller), |
25 message_box_view_(NULL) { | 26 message_box_view_(NULL) { |
26 message_box_view_ = new MessageBoxView( | 27 message_box_view_ = new MessageBoxView( |
27 MessageBoxView::kIsConfirmMessageBox, | 28 MessageBox::kIsConfirmMessageBox, |
28 l10n_util::GetString(IDS_HTTP_POST_WARNING), | 29 l10n_util::GetString(IDS_HTTP_POST_WARNING), |
29 L""); | 30 L""); |
30 // TODO(beng): fix this - this dialog box should be shown by a method on the | 31 // TODO(beng): fix this - this dialog box should be shown by a method on the |
31 // Browser. | 32 // Browser. |
32 HWND root_hwnd = NULL; | 33 HWND root_hwnd = NULL; |
33 if (BrowserList::GetLastActive()) { | 34 if (BrowserList::GetLastActive()) { |
34 root_hwnd = reinterpret_cast<HWND>(BrowserList::GetLastActive()-> | 35 root_hwnd = reinterpret_cast<HWND>(BrowserList::GetLastActive()-> |
35 window()->GetNativeHandle()); | 36 window()->GetNativeHandle()); |
36 } | 37 } |
37 views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this)->Show(); | 38 views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this)->Show(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // the same page anymore) or if the tab is closed, because then we won't have | 96 // the same page anymore) or if the tab is closed, because then we won't have |
96 // a navigation controller anymore. | 97 // a navigation controller anymore. |
97 if (window() && navigation_controller_ && | 98 if (window() && navigation_controller_ && |
98 (type == NotificationType::LOAD_START || | 99 (type == NotificationType::LOAD_START || |
99 type == NotificationType::TAB_CLOSING) && | 100 type == NotificationType::TAB_CLOSING) && |
100 Source<NavigationController>(source).ptr() == navigation_controller_) { | 101 Source<NavigationController>(source).ptr() == navigation_controller_) { |
101 navigation_controller_ = NULL; | 102 navigation_controller_ = NULL; |
102 window()->Close(); | 103 window()->Close(); |
103 } | 104 } |
104 } | 105 } |
OLD | NEW |