| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 2709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2720 const std::string& data, PageSavingSerializationStatus status) { | 2720 const std::string& data, PageSavingSerializationStatus status) { |
| 2721 Send(new ViewHostMsg_SendSerializedHtmlData(routing_id_, | 2721 Send(new ViewHostMsg_SendSerializedHtmlData(routing_id_, |
| 2722 frame_url, data, static_cast<int32>(status))); | 2722 frame_url, data, static_cast<int32>(status))); |
| 2723 } | 2723 } |
| 2724 | 2724 |
| 2725 void RenderView::OnMsgShouldClose() { | 2725 void RenderView::OnMsgShouldClose() { |
| 2726 bool should_close = webview()->ShouldClose(); | 2726 bool should_close = webview()->ShouldClose(); |
| 2727 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); | 2727 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close)); |
| 2728 } | 2728 } |
| 2729 | 2729 |
| 2730 void RenderView::OnClosePage(int new_render_process_host_id, | 2730 void RenderView::OnClosePage(const ViewMsg_ClosePage_Params& params) { |
| 2731 int new_request_id) { | |
| 2732 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 2731 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
| 2733 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 2732 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
| 2734 // in the onunload handler from appearing. For now, we're bypassing that and | 2733 // in the onunload handler from appearing. For now, we're bypassing that and |
| 2735 // calling the FrameLoader's CloseURL method directly. This should be | 2734 // calling the FrameLoader's CloseURL method directly. This should be |
| 2736 // revisited to avoid having two ways to close a page. Having a single way | 2735 // revisited to avoid having two ways to close a page. Having a single way |
| 2737 // to close that can run onunload is also useful for fixing | 2736 // to close that can run onunload is also useful for fixing |
| 2738 // http://b/issue?id=753080. | 2737 // http://b/issue?id=753080. |
| 2739 WebFrame* main_frame = webview()->GetMainFrame(); | 2738 WebFrame* main_frame = webview()->GetMainFrame(); |
| 2740 if (main_frame) { | 2739 if (main_frame) { |
| 2741 const GURL& url = main_frame->GetURL(); | 2740 const GURL& url = main_frame->GetURL(); |
| 2742 // TODO(davemoore) this code should be removed once WillCloseFrame() gets | 2741 // TODO(davemoore) this code should be removed once WillCloseFrame() gets |
| 2743 // called when a page is destroyed. DumpLoadHistograms() is safe to call | 2742 // called when a page is destroyed. DumpLoadHistograms() is safe to call |
| 2744 // multiple times for the same frame, but it will simplify things. | 2743 // multiple times for the same frame, but it will simplify things. |
| 2745 if (url.SchemeIs("http") || url.SchemeIs("https")) | 2744 if (url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme)) |
| 2746 DumpLoadHistograms(); | 2745 DumpLoadHistograms(); |
| 2747 main_frame->ClosePage(); | 2746 main_frame->ClosePage(); |
| 2748 } | 2747 } |
| 2749 | 2748 |
| 2750 Send(new ViewHostMsg_ClosePage_ACK(routing_id_, | 2749 // Just echo back the params in the ACK. |
| 2751 new_render_process_host_id, | 2750 Send(new ViewHostMsg_ClosePage_ACK(routing_id_, params)); |
| 2752 new_request_id)); | |
| 2753 } | 2751 } |
| 2754 | 2752 |
| 2755 void RenderView::OnThemeChanged() { | 2753 void RenderView::OnThemeChanged() { |
| 2756 #if defined(OS_WIN) | 2754 #if defined(OS_WIN) |
| 2757 gfx::NativeTheme::instance()->CloseHandles(); | 2755 gfx::NativeTheme::instance()->CloseHandles(); |
| 2758 gfx::Rect view_rect(0, 0, size_.width(), size_.height()); | 2756 gfx::Rect view_rect(0, 0, size_.width(), size_.height()); |
| 2759 didInvalidateRect(view_rect); | 2757 didInvalidateRect(view_rect); |
| 2760 #else // defined(OS_WIN) | 2758 #else // defined(OS_WIN) |
| 2761 // TODO(port): we don't support theming on non-Windows platforms yet | 2759 // TODO(port): we don't support theming on non-Windows platforms yet |
| 2762 NOTIMPLEMENTED(); | 2760 NOTIMPLEMENTED(); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3069 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); | 3067 Send(new ViewHostMsg_PasswordFormsSeen(routing_id_, password_forms)); |
| 3070 } | 3068 } |
| 3071 | 3069 |
| 3072 void RenderView::Print(WebFrame* frame, bool script_initiated) { | 3070 void RenderView::Print(WebFrame* frame, bool script_initiated) { |
| 3073 DCHECK(frame); | 3071 DCHECK(frame); |
| 3074 if (print_helper_.get() == NULL) { | 3072 if (print_helper_.get() == NULL) { |
| 3075 print_helper_.reset(new PrintWebViewHelper(this)); | 3073 print_helper_.reset(new PrintWebViewHelper(this)); |
| 3076 } | 3074 } |
| 3077 print_helper_->Print(frame, script_initiated); | 3075 print_helper_->Print(frame, script_initiated); |
| 3078 } | 3076 } |
| OLD | NEW |