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