summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-25 22:11:06 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-25 22:11:06 +0000
commit1f5af444f94761190a16ac6088ad6e6831aeb4a0 (patch)
tree6c89513715320dacc744a49e0e2104a4ee3e9807 /chrome
parentde8d2667d6953abb31b7c5385ca718ad47adf6a1 (diff)
downloadchromium_src-1f5af444f94761190a16ac6088ad6e6831aeb4a0.zip
chromium_src-1f5af444f94761190a16ac6088ad6e6831aeb4a0.tar.gz
chromium_src-1f5af444f94761190a16ac6088ad6e6831aeb4a0.tar.bz2
Move a bunch of stuff out of WebContents. I removed a bunch of render view host pass-throughs and just made the callers call the render view host directly. I don't think we're trying to isolate the layers to this degree, and WebContents is so big these just added noise.
I removed the RenderViewHost->WebContents->SavePackage pass-through by using a delegate that the SavePackage implements (like we already do for find in page). I also noticed some file upload stuff wasn't used at all and removed it. Review URL: http://codereview.chromium.org/4088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2612 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc8
-rw-r--r--chrome/browser/browser.cc4
-rw-r--r--chrome/browser/browser_commands.cc2
-rw-r--r--chrome/browser/dom_ui/dom_ui_host.cc3
-rw-r--r--chrome/browser/download/save_file_manager.cc2
-rw-r--r--chrome/browser/download/save_package.cc16
-rw-r--r--chrome/browser/download/save_package.h70
-rw-r--r--chrome/browser/jsmessage_box_handler.cc2
-rw-r--r--chrome/browser/password_manager.cc2
-rw-r--r--chrome/browser/plugin_installer.cc2
-rw-r--r--chrome/browser/render_view_context_menu_controller.cc25
-rw-r--r--chrome/browser/render_view_host.cc34
-rw-r--r--chrome/browser/render_view_host.h12
-rw-r--r--chrome/browser/render_view_host_delegate.h46
-rw-r--r--chrome/browser/ssl_manager.cc3
-rw-r--r--chrome/browser/web_contents.cc163
-rw-r--r--chrome/browser/web_contents.h112
-rw-r--r--chrome/browser/web_drop_target.cc8
18 files changed, 132 insertions, 382 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 8c2da33..7b4f600 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -1591,8 +1591,10 @@ void AutomationProvider::ExecuteJavascript(const IPC::Message& message,
L"javascript:void(window.domAutomationController.setAutomationId(%d));",
message.routing_id());
- web_contents->ExecuteJavascriptInWebFrame(frame_xpath, url);
- web_contents->ExecuteJavascriptInWebFrame(frame_xpath, script);
+ web_contents->render_view_host()->ExecuteJavascriptInWebFrame(
+ frame_xpath, url);
+ web_contents->render_view_host()->ExecuteJavascriptInWebFrame(
+ frame_xpath, script);
succeeded = true;
}
@@ -1768,7 +1770,7 @@ void AutomationProvider::HandleInspectElementRequest(
const IPC::Message& message, int handle, int x, int y) {
WebContents* web_contents = GetWebContentsForHandle(handle, NULL);
if (web_contents) {
- web_contents->InspectElementAt(x, y);
+ web_contents->render_view_host()->InspectElementAt(x, y);
inspect_element_routing_id_ = message.routing_id();
} else {
Send(new AutomationMsg_InspectElementResponse(message.routing_id(), -1));
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 52706f5..2f1e4f3 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1104,7 +1104,7 @@ void Browser::ProcessPendingTabs() {
// unload tabs.
if (!tabs_needing_before_unload_fired_.empty()) {
TabContents* tab = tabs_needing_before_unload_fired_.back();
- tab->AsWebContents()->FirePageBeforeUnload();
+ tab->AsWebContents()->render_view_host()->FirePageBeforeUnload();
} else if (!tabs_needing_unload_fired_.empty()) {
// We've finished firing all beforeunload events and can proceed with unload
// events.
@@ -1115,7 +1115,7 @@ void Browser::ProcessPendingTabs() {
// get a perf benefit from that in the cases where the tab hangs in it's
// unload handler or takes a long time to page in.
TabContents* tab = tabs_needing_unload_fired_.back();
- tab->AsWebContents()->FirePageUnload();
+ tab->AsWebContents()->render_view_host()->FirePageUnload();
} else {
NOTREACHED();
}
diff --git a/chrome/browser/browser_commands.cc b/chrome/browser/browser_commands.cc
index a3f6268..063e99a 100644
--- a/chrome/browser/browser_commands.cc
+++ b/chrome/browser/browser_commands.cc
@@ -460,7 +460,7 @@ void Browser::ExecuteCommand(int id) {
TabContents* current_tab = GetSelectedTabContents();
if (current_tab && current_tab->AsWebContents()) {
WebContents* wc = current_tab->AsWebContents();
- wc->ShowJavaScriptConsole();
+ wc->render_view_host()->ShowJavaScriptConsole();
}
break;
}
diff --git a/chrome/browser/dom_ui/dom_ui_host.cc b/chrome/browser/dom_ui/dom_ui_host.cc
index ccbe241..b46affd 100644
--- a/chrome/browser/dom_ui/dom_ui_host.cc
+++ b/chrome/browser/dom_ui/dom_ui_host.cc
@@ -111,6 +111,7 @@ void DOMUIHost::ExecuteJavascript(const std::wstring& javascript) {
// URL is interpreted, it will be unescaped.
std::wstring escaped_js(javascript);
ReplaceSubstringsAfterOffset(&escaped_js, 0, L"%", L"%25");
- ExecuteJavascriptInWebFrame(L"", L"javascript:" + escaped_js);
+ render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(),
+ L"javascript:" + escaped_js);
}
diff --git a/chrome/browser/download/save_file_manager.cc b/chrome/browser/download/save_file_manager.cc
index 13b2d1f..940e878 100644
--- a/chrome/browser/download/save_file_manager.cc
+++ b/chrome/browser/download/save_file_manager.cc
@@ -221,7 +221,7 @@ SavePackage* SaveFileManager::GetSavePackageFromRenderIds(
// Convert const pointer of WebContents to pointer of WebContents.
const WebContents* web_contents = contents->AsWebContents();
if (web_contents)
- return web_contents->get_save_package();
+ return web_contents->save_package();
}
return NULL;
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index ec350ea..127fa53 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -757,15 +757,16 @@ void SavePackage::GetSerializedHtmlDataForCurrentPageWithLocalLinks() {
relative_dir_name = std::wstring(L"./") + relative_dir_name + L"/";
- web_contents_->GetSerializedHtmlDataForCurrentPageWithLocalLinks(
- saved_links, saved_file_paths, relative_dir_name);
+ web_contents_->render_view_host()->
+ GetSerializedHtmlDataForCurrentPageWithLocalLinks(
+ saved_links, saved_file_paths, relative_dir_name);
}
// Process the serialized HTML content data of a specified web page
// retrieved from render process.
-void SavePackage::ProcessSerializedHtmlData(const GURL& frame_url,
- const std::string& data,
- int32 status) {
+void SavePackage::OnReceivedSerializedHtmlData(const GURL& frame_url,
+ const std::string& data,
+ int32 status) {
webkit_glue::DomSerializerDelegate::PageSavingSerializationStatus flag =
static_cast<webkit_glue::DomSerializerDelegate::PageSavingSerializationStatus>
(status);
@@ -831,13 +832,14 @@ void SavePackage::GetAllSavableResourceLinksForCurrentPage() {
wait_state_ = RESOURCES_LIST;
GURL main_page_url(page_url_);
- web_contents_->GetAllSavableResourceLinksForCurrentPage(main_page_url);
+ web_contents_->render_view_host()->
+ GetAllSavableResourceLinksForCurrentPage(main_page_url);
}
// Give backend the lists which contain all resource links that have local
// storage, after which, render process will serialize DOM for generating
// HTML data.
-void SavePackage::ProcessCurrentPageAllSavableResourceLinks(
+void SavePackage::OnReceivedSavableResourceLinksForCurrentPage(
const std::vector<GURL>& resources_list,
const std::vector<GURL>& referrers_list,
const std::vector<GURL>& frames_list) {
diff --git a/chrome/browser/download/save_package.h b/chrome/browser/download/save_package.h
index 7b6edcd..101007b 100644
--- a/chrome/browser/download/save_package.h
+++ b/chrome/browser/download/save_package.h
@@ -1,22 +1,9 @@
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// The SavePackage object manages the process of saving a page as only-html or
-// complete-html and providing the information for displaying saving status.
-// Saving page as only-html means means that we save web page to a single HTML
-// file regardless internal sub resources and sub frames.
-// Saving page as complete-html page means we save not only the main html file
-// the user told it to save but also a directory for the auxiliary files such
-// as all sub-frame html files, image files, css files and js files.
-//
-// Each page saving job may include one or multiple files which need to be
-// saved. Each file is represented by a SaveItem, and all SaveItems are owned
-// by the SavePackage. SaveItems are created when a user initiates a page
-// saving job, and exist for the duration of one tab's life time.
-#ifndef CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H__
-#define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H__
+#ifndef CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_
+#define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_
#include <string>
#include <vector>
@@ -30,6 +17,7 @@
#include "chrome/common/pref_member.h"
#include "chrome/browser/download/save_item.h"
#include "chrome/browser/download/save_types.h"
+#include "chrome/browser/render_view_host_delegate.h"
class SaveFileManager;
class SavePackage;
@@ -47,8 +35,20 @@ namespace base {
class Thread;
}
-// save package: manages all save item.
-class SavePackage : public base::RefCountedThreadSafe<SavePackage> {
+// The SavePackage object manages the process of saving a page as only-html or
+// complete-html and providing the information for displaying saving status.
+// Saving page as only-html means means that we save web page to a single HTML
+// file regardless internal sub resources and sub frames.
+// Saving page as complete-html page means we save not only the main html file
+// the user told it to save but also a directory for the auxiliary files such
+// as all sub-frame html files, image files, css files and js files.
+//
+// Each page saving job may include one or multiple files which need to be
+// saved. Each file is represented by a SaveItem, and all SaveItems are owned
+// by the SavePackage. SaveItems are created when a user initiates a page
+// saving job, and exist for the duration of one tab's life time.
+class SavePackage : public base::RefCountedThreadSafe<SavePackage>,
+ public RenderViewHostDelegate::Save {
public:
enum SavePackageType {
// User chose to save only the HTML of the page.
@@ -98,20 +98,6 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage> {
void SaveFailed(const std::wstring& save_url);
void SaveCanceled(SaveItem* save_item);
- // Process current page's all savable links of sub resources, resources'
- // referrer and frames(include main frame and sub frames) gotten from
- // render process.
- void ProcessCurrentPageAllSavableResourceLinks(
- const std::vector<GURL>& resources_list,
- const std::vector<GURL>& referrers_list,
- const std::vector<GURL>& frames_list);
-
- // Process the serialized html content data of a specified web page
- // gotten from render process.
- void ProcessSerializedHtmlData(const GURL& frame_url,
- const std::string& data,
- int32 status);
-
// Rough percent complete, -1 means we don't know (since we didn't receive a
// total size).
int PercentComplete();
@@ -129,6 +115,24 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage> {
// Now we actually use render_process_id as tab's unique id.
int tab_id() const { return tab_id_; }
+ // RenderViewHostDelegate::Save ----------------------------------------------
+
+ // Process all of the current page's savable links of subresources, resources
+ // referrers and frames (including the main frame and subframes) from the
+ // render view host.
+ virtual void OnReceivedSavableResourceLinksForCurrentPage(
+ const std::vector<GURL>& resources_list,
+ const std::vector<GURL>& referrers_list,
+ const std::vector<GURL>& frames_list);
+
+ // Process the serialized html content data of a specified web page
+ // gotten from render process.
+ virtual void OnReceivedSerializedHtmlData(const GURL& frame_url,
+ const std::string& data,
+ int32 status);
+
+ // Statics -------------------------------------------------------------------
+
// Helper function for preparing suggested name for the SaveAs Dialog. The
// suggested name is composed of the default save path and the web document's
// title.
@@ -306,7 +310,7 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage> {
// Unique id for this SavePackage.
const int tab_id_;
- DISALLOW_EVIL_CONSTRUCTORS(SavePackage);
+ DISALLOW_COPY_AND_ASSIGN(SavePackage);
};
-#endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H__
+#endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_
diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc
index a6fc385..4bb020a 100644
--- a/chrome/browser/jsmessage_box_handler.cc
+++ b/chrome/browser/jsmessage_box_handler.cc
@@ -87,7 +87,7 @@ void JavascriptMessageBoxHandler::WindowClosing() {
dialog_ = NULL;
if (message_box_view_->IsCheckBoxSelected() && web_contents_)
- web_contents_->SetSuppressJavascriptMessageBoxes(true);
+ web_contents_->set_suppress_javascript_messages(true);
delete this;
}
diff --git a/chrome/browser/password_manager.cc b/chrome/browser/password_manager.cc
index fa4ae3b..38c50d9 100644
--- a/chrome/browser/password_manager.cc
+++ b/chrome/browser/password_manager.cc
@@ -172,7 +172,7 @@ void PasswordManager::Autofill(const PasswordForm& form_for_autofill,
PasswordFormDomManager::CreateFillData(form_for_autofill,
best_matches, preferred_match,
action_mismatch));
- web_contents_->FillPasswordForm(*fill_data);
+ web_contents_->render_view_host()->FillPasswordForm(*fill_data);
return;
}
default:
diff --git a/chrome/browser/plugin_installer.cc b/chrome/browser/plugin_installer.cc
index 67d6112..9ccaad8 100644
--- a/chrome/browser/plugin_installer.cc
+++ b/chrome/browser/plugin_installer.cc
@@ -59,7 +59,7 @@ void PluginInstaller::OnBarDestroy(InfoBarConfirmView* bar) {
void PluginInstaller::OnOKButtonPressed() {
current_bar_->BeginClose();
- web_contents_->InstallMissingPlugin();
+ web_contents_->render_view_host()->InstallMissingPlugin();
}
PluginInstaller::PluginInstallerBar
diff --git a/chrome/browser/render_view_context_menu_controller.cc b/chrome/browser/render_view_context_menu_controller.cc
index 2968c6d..98eaf85 100644
--- a/chrome/browser/render_view_context_menu_controller.cc
+++ b/chrome/browser/render_view_context_menu_controller.cc
@@ -51,11 +51,11 @@ void RenderViewContextMenuController::OpenURL(
}
void RenderViewContextMenuController::CopyImageAt(int x, int y) {
- source_web_contents_->CopyImageAt(x, y);
+ source_web_contents_->render_view_host()->CopyImageAt(x, y);
}
void RenderViewContextMenuController::Inspect(int x, int y) {
- source_web_contents_->InspectElementAt(x, y);
+ source_web_contents_->render_view_host()->InspectElementAt(x, y);
}
void RenderViewContextMenuController::WriteTextToClipboard(
@@ -344,31 +344,31 @@ void RenderViewContextMenuController::ExecuteCommand(int id) {
}
case IDS_CONTENT_CONTEXT_UNDO:
- source_web_contents_->Undo();
+ source_web_contents_->render_view_host()->Undo();
break;
case IDS_CONTENT_CONTEXT_REDO:
- source_web_contents_->Redo();
+ source_web_contents_->render_view_host()->Redo();
break;
case IDS_CONTENT_CONTEXT_CUT:
- source_web_contents_->Cut();
+ source_web_contents_->render_view_host()->Cut();
break;
case IDS_CONTENT_CONTEXT_COPY:
- source_web_contents_->Copy();
+ source_web_contents_->render_view_host()->Copy();
break;
case IDS_CONTENT_CONTEXT_PASTE:
- source_web_contents_->Paste();
+ source_web_contents_->render_view_host()->Paste();
break;
case IDS_CONTENT_CONTEXT_DELETE:
- source_web_contents_->Delete();
+ source_web_contents_->render_view_host()->Delete();
break;
case IDS_CONTENT_CONTEXT_SELECTALL:
- source_web_contents_->SelectAll();
+ source_web_contents_->render_view_host()->SelectAll();
break;
case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: {
@@ -389,12 +389,13 @@ void RenderViewContextMenuController::ExecuteCommand(int id) {
case IDC_USESPELLCHECKSUGGESTION_2:
case IDC_USESPELLCHECKSUGGESTION_3:
case IDC_USESPELLCHECKSUGGESTION_4:
- source_web_contents_->Replace(params_.dictionary_suggestions[
- id - IDC_USESPELLCHECKSUGGESTION_0]);
+ source_web_contents_->render_view_host()->Replace(
+ params_.dictionary_suggestions[id - IDC_USESPELLCHECKSUGGESTION_0]);
break;
case IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY:
- source_web_contents_->AddToDictionary(params_.misspelled_word);
+ source_web_contents_->render_view_host()->AddToDictionary(
+ params_.misspelled_word);
break;
case IDS_CONTENT_CONTEXT_ADDSEARCHENGINE: // Not implemented.
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc
index 27b25c9..9128c87 100644
--- a/chrome/browser/render_view_host.cc
+++ b/chrome/browser/render_view_host.cc
@@ -307,6 +307,9 @@ void RenderViewHost::StartFinding(int request_id,
bool forward,
bool match_case,
bool find_next) {
+ if (search_string.empty())
+ return;
+
FindInPageRequest request;
request.request_id = request_id;
request.search_string = search_string;
@@ -373,25 +376,6 @@ void RenderViewHost::DragTargetDrop(
Send(new ViewMsg_DragTargetDrop(routing_id_, client_pt, screen_pt));
}
-void RenderViewHost::UploadFile(const std::wstring& file_path,
- const std::wstring& form,
- const std::wstring& file,
- const std::wstring& submit,
- const std::wstring& other_values) {
- if (!process_->channel())
- return;
-
- RendererSecurityPolicy::GetInstance()->GrantUploadFile(process()->host_id(),
- file);
- ViewMsg_UploadFile_Params p;
- p.file_path = file_path;
- p.form = form;
- p.file = file;
- p.submit = submit;
- p.other_values = other_values;
- Send(new ViewMsg_UploadFile(routing_id_, p));
-}
-
void RenderViewHost::ReservePageIDRange(int size) {
Send(new ViewMsg_ReservePageIDRange(routing_id_, size));
}
@@ -1140,9 +1124,11 @@ void RenderViewHost::OnReceivedSavableResourceLinksForCurrentPage(
const std::vector<GURL>& resources_list,
const std::vector<GURL>& referrers_list,
const std::vector<GURL>& frames_list) {
- delegate_->OnReceivedSavableResourceLinksForCurrentPage(resources_list,
- referrers_list,
- frames_list);
+ RenderViewHostDelegate::Save* save_delegate = delegate_->GetSaveDelegate();
+ if (save_delegate) {
+ save_delegate->OnReceivedSavableResourceLinksForCurrentPage(
+ resources_list, referrers_list, frames_list);
+ }
}
void RenderViewHost::OnDidGetApplicationInfo(
@@ -1162,7 +1148,9 @@ void RenderViewHost::GetSerializedHtmlDataForCurrentPageWithLocalLinks(
void RenderViewHost::OnReceivedSerializedHtmlData(const GURL& frame_url,
const std::string& data,
int32 status) {
- delegate_->OnReceivedSerializedHtmlData(frame_url, data, status);
+ RenderViewHostDelegate::Save* save_delegate = delegate_->GetSaveDelegate();
+ if (save_delegate)
+ save_delegate->OnReceivedSerializedHtmlData(frame_url, data, status);
}
void RenderViewHost::OnMsgShouldCloseACK(bool proceed) {
diff --git a/chrome/browser/render_view_host.h b/chrome/browser/render_view_host.h
index b6d968d..13b40ac 100644
--- a/chrome/browser/render_view_host.h
+++ b/chrome/browser/render_view_host.h
@@ -137,7 +137,7 @@ class RenderViewHost : public RenderWidgetHost {
// ViewMsg_ShouldClose. This is where the page itself is closed. The
// unload handler is triggered here, which can block with a dialog, but cannot
// cancel the close of the page.
- virtual void FirePageUnload();
+ void FirePageUnload();
// Close the page ignoring whether it has unload events registers.
// This is called after the beforeunload and unload events have fired
@@ -215,14 +215,6 @@ class RenderViewHost : public RenderWidgetHost {
void DragTargetDrop(const gfx::Point& client_pt,
const gfx::Point& screen_pt);
- // Uploads a file by automatically completing a form within the page and
- // submitting it.
- void UploadFile(const std::wstring& file_path,
- const std::wstring& form,
- const std::wstring& file,
- const std::wstring& submit,
- const std::wstring& other_values);
-
// Tell the RenderView to reserve a range of page ids of the given size.
void ReservePageIDRange(int size);
@@ -346,7 +338,7 @@ class RenderViewHost : public RenderWidgetHost {
void UpdateWebPreferences(const WebPreferences& prefs);
// Request the Renderer to ask the default plugin to start installation of
- // missing plugin.
+ // missing plugin. Called by PluginInstaller.
void InstallMissingPlugin();
// Get all savable resource links from current webpage, include main
diff --git a/chrome/browser/render_view_host_delegate.h b/chrome/browser/render_view_host_delegate.h
index 8e541348..036a88cb 100644
--- a/chrome/browser/render_view_host_delegate.h
+++ b/chrome/browser/render_view_host_delegate.h
@@ -57,8 +57,32 @@ class RenderViewHostDelegate {
bool final_update) = 0;
};
- // Returns the current find in page delegate, if any.
- virtual FindInPage* GetFindInPageDelegate() { return NULL; }
+ // Interface for saving web pages.
+ class Save {
+ public:
+ // Notification that we get when we receive all savable links of
+ // sub-resources for the current page, their referrers and list of frames
+ // (include main frame and sub frames).
+ virtual void OnReceivedSavableResourceLinksForCurrentPage(
+ const std::vector<GURL>& resources_list,
+ const std::vector<GURL>& referrers_list,
+ const std::vector<GURL>& frames_list) = 0;
+
+ // Notification that we get when we receive serialized html content data of
+ // a specified web page from render process. The parameter frame_url
+ // specifies what frame the data belongs. The parameter data contains the
+ // available data for sending. The parameter status indicates the
+ // serialization status, See
+ // webkit_glue::DomSerializerDelegate::PageSavingSerializationStatus for
+ // the detail meaning of status.
+ virtual void OnReceivedSerializedHtmlData(const GURL& frame_url,
+ const std::string& data,
+ int32 status) = 0;
+ };
+
+ // Returns the current delegate associated with a feature. May be NULL.
+ virtual FindInPage* GetFindInPageDelegate() const { return NULL; }
+ virtual Save* GetSaveDelegate() const { return NULL; }
// Retrieves the profile to be used.
virtual Profile* GetProfile() const = 0;
@@ -291,24 +315,6 @@ class RenderViewHostDelegate {
// Notification from the renderer that JS runs out of memory.
virtual void OnJSOutOfMemory() { }
- // Notification that we get when we receive all savable links of
- // sub-resources for the current page, their referrers and list of frames
- // (include main frame and sub frames).
- virtual void OnReceivedSavableResourceLinksForCurrentPage(
- const std::vector<GURL>& resources_list,
- const std::vector<GURL>& referrers_list,
- const std::vector<GURL>& frames_list) { }
-
- // Notification that we get when we receive serialized html content data of a
- // specified web page from render process. The parameter frame_url specifies
- // what frame the data belongs. The parameter data contains the available
- // data for sending. The parameter status indicates the serialization status,
- // See webkit_glue::DomSerializerDelegate::PageSavingSerializationStatus for
- // the detail meaning of status.
- virtual void OnReceivedSerializedHtmlData(const GURL& frame_url,
- const std::string& data,
- int32 status) { }
-
// Notification whether we should close the page, after an explicit call to
// AttemptToClosePage. This is called before a cross-site request or before
// a tab/window is closed, to allow the appropriate renderer to approve or
diff --git a/chrome/browser/ssl_manager.cc b/chrome/browser/ssl_manager.cc
index 94bc42e..4575e5f 100644
--- a/chrome/browser/ssl_manager.cc
+++ b/chrome/browser/ssl_manager.cc
@@ -196,7 +196,8 @@ void SSLManager::AddMessageToConsole(const std::wstring& msg,
if (!web_contents)
return;
- web_contents->AddMessageToConsole(std::wstring(), msg, level);
+ web_contents->render_view_host()->AddMessageToConsole(
+ std::wstring(), msg, level);
}
// Delegate API method.
diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc
index 35c55ad..9549f4b 100644
--- a/chrome/browser/web_contents.cc
+++ b/chrome/browser/web_contents.cc
@@ -281,14 +281,6 @@ void WebContents::SizeContents(const gfx::Size& size) {
RepositionSupressedPopupsToFit(size);
}
-void WebContents::FirePageBeforeUnload() {
- render_view_host()->FirePageBeforeUnload();
-}
-
-void WebContents::FirePageUnload() {
- render_view_host()->FirePageUnload();
-}
-
void WebContents::Destroy() {
// Tell the notification service we no longer want notifications.
NotificationService::current()->
@@ -684,8 +676,6 @@ void WebContents::StartFinding(int request_id,
bool forward,
bool match_case,
bool find_next) {
- if (search_string.empty())
- return;
render_view_host()->StartFinding(request_id, search_string, forward,
match_case, find_next);
}
@@ -746,34 +736,6 @@ bool WebContents::GetFindInPageWindowLocation(int* x, int* y) {
return false;
}
-
-void WebContents::AlterTextSize(text_zoom::TextSize size) {
- render_view_host()->AlterTextSize(size);
- // TODO(creis): should this be propagated to other and future RVHs?
-}
-
-void WebContents::SetPageEncoding(const std::wstring& encoding_name) {
- render_view_host()->SetPageEncoding(encoding_name);
- // TODO(creis): should this be propagated to other and future RVHs?
-}
-
-void WebContents::CopyImageAt(int x, int y) {
- render_view_host()->CopyImageAt(x, y);
-}
-
-void WebContents::InspectElementAt(int x, int y) {
- render_view_host()->InspectElementAt(x, y);
-}
-
-void WebContents::ShowJavaScriptConsole() {
- render_view_host()->ShowJavaScriptConsole();
-}
-
-void WebContents::AllowDomAutomationBindings() {
- render_view_host()->AllowDomAutomationBindings();
- // TODO(creis): should this be propagated to other and future RVHs?
-}
-
void WebContents::OnJavaScriptMessageBoxClosed(IPC::Message* reply_msg,
bool success,
const std::wstring& prompt) {
@@ -849,11 +811,6 @@ void WebContents::NotifyDisconnected() {
NotificationService::NoDetails());
}
-void WebContents::SetSuppressJavascriptMessageBoxes(
- bool suppress_javascript_messages) {
- suppress_javascript_messages_ = suppress_javascript_messages;
-}
-
void WebContents::UpdateHistoryForNavigation(const GURL& display_url,
const ViewHostMsg_FrameNavigate_Params& params) {
if (profile()->IsOffTheRecord())
@@ -938,49 +895,6 @@ InfoBarView* WebContents::GetInfoBarView() {
return info_bar_view_.get();
}
-void WebContents::ExecuteJavascriptInWebFrame(
- const std::wstring& frame_xpath, const std::wstring& jscript) {
- render_view_host()->ExecuteJavascriptInWebFrame(frame_xpath, jscript);
-}
-
-void WebContents::AddMessageToConsole(
- const std::wstring& frame_xpath, const std::wstring& msg,
- ConsoleMessageLevel level) {
- render_view_host()->AddMessageToConsole(frame_xpath, msg, level);
-}
-
-void WebContents::Undo() {
- render_view_host()->Undo();
-}
-
-void WebContents::Redo() {
- render_view_host()->Redo();
-}
-
-void WebContents::Replace(const std::wstring& text) {
- render_view_host()->Replace(text);
-}
-
-void WebContents::AddToDictionary(const std::wstring& word) {
- render_view_host()->AddToDictionary(word);
-}
-
-void WebContents::Delete() {
- render_view_host()->Delete();
-}
-
-void WebContents::SelectAll() {
- render_view_host()->SelectAll();
-}
-
-void WebContents::StartFileUpload(const std::wstring& file_path,
- const std::wstring& form,
- const std::wstring& file,
- const std::wstring& submit,
- const std::wstring& other_values) {
- render_view_host()->UploadFile(file_path, form, file, submit, other_values);
-}
-
void WebContents::SetWebApp(WebApp* web_app) {
if (web_app_.get()) {
web_app_->RemoveObserver(this);
@@ -1022,34 +936,6 @@ void WebContents::CreateShortcut() {
render_view_host()->GetApplicationInfo(pending_install_.page_id);
}
-void WebContents::FillForm(const FormData& form) {
- render_view_host()->FillForm(form);
-}
-
-void WebContents::FillPasswordForm(
- const PasswordFormDomManager::FillData& form_data) {
- render_view_host()->FillPasswordForm(form_data);
-}
-
-void WebContents::DragTargetDragEnter(const WebDropData& drop_data,
- const gfx::Point& client_pt, const gfx::Point& screen_pt) {
- render_view_host()->DragTargetDragEnter(drop_data, client_pt, screen_pt);
-}
-
-void WebContents::DragTargetDragOver(
- const gfx::Point& client_pt, const gfx::Point& screen_pt) {
- render_view_host()->DragTargetDragOver(client_pt, screen_pt);
-}
-
-void WebContents::DragTargetDragLeave() {
- render_view_host()->DragTargetDragLeave();
-}
-
-void WebContents::DragTargetDrop(
- const gfx::Point& client_pt, const gfx::Point& screen_pt) {
- render_view_host()->DragTargetDrop(client_pt, screen_pt);
-}
-
PasswordManager* WebContents::GetPasswordManager() {
if (password_manager_.get() == NULL)
password_manager_.reset(new PasswordManager(this));
@@ -1072,12 +958,16 @@ bool WebContents::IsActiveEntry(int32 page_id) {
///////////////////////////////////////////////////////////////////////////////
// RenderViewHostDelegate implementation:
-RenderViewHostDelegate::FindInPage* WebContents::GetFindInPageDelegate() {
+RenderViewHostDelegate::FindInPage* WebContents::GetFindInPageDelegate() const {
// The find in page controller implements this interface for us. Our return
// value can be NULL, so it's fine if the find in controller doesn't exist.
return find_in_page_controller_.get();
}
+RenderViewHostDelegate::Save* WebContents::GetSaveDelegate() const {
+ return save_package_.get(); // May be NULL, but we can return NULL.
+}
+
Profile* WebContents::GetProfile() const {
return profile();
}
@@ -1788,7 +1678,6 @@ void WebContents::ProcessExternalHostMessage(const std::string& receiver,
void WebContents::GoToEntryAtOffset(int offset) {
if (!controller())
return;
-
controller()->GoToOffset(offset);
}
@@ -2418,48 +2307,6 @@ std::wstring WebContents::GetStatusText() const {
return std::wstring();
}
-// Called by PluginInstaller to start installation of missing plugin.
-void WebContents::InstallMissingPlugin() {
- render_view_host()->InstallMissingPlugin();
-}
-
-void WebContents::GetAllSavableResourceLinksForCurrentPage(
- const GURL& page_url) {
- render_view_host()->GetAllSavableResourceLinksForCurrentPage(
- page_url);
-}
-
-void WebContents::OnReceivedSavableResourceLinksForCurrentPage(
- const std::vector<GURL>& resources_list,
- const std::vector<GURL>& referrers_list,
- const std::vector<GURL>& frames_list) {
- SavePackage* save_package = get_save_package();
- if (save_package) {
- save_package->ProcessCurrentPageAllSavableResourceLinks(resources_list,
- referrers_list,
- frames_list);
- }
-}
-
-void WebContents::GetSerializedHtmlDataForCurrentPageWithLocalLinks(
- const std::vector<std::wstring>& links,
- const std::vector<std::wstring>& local_paths,
- const std::wstring& local_directory_name) {
- render_view_host()->GetSerializedHtmlDataForCurrentPageWithLocalLinks(
- links, local_paths, local_directory_name);
-}
-
-
-void WebContents::OnReceivedSerializedHtmlData(const GURL& frame_url,
- const std::string& data,
- int32 status) {
- SavePackage* save_package = get_save_package();
- if (save_package)
- save_package->ProcessSerializedHtmlData(frame_url,
- data,
- status);
-}
-
bool WebContents::CanBlur() const {
return delegate() ? delegate()->CanBlur() : true;
}
diff --git a/chrome/browser/web_contents.h b/chrome/browser/web_contents.h
index fdb0fff..1e23645 100644
--- a/chrome/browser/web_contents.h
+++ b/chrome/browser/web_contents.h
@@ -55,16 +55,6 @@ class WebContents : public TabContents,
virtual void HideContents();
virtual void SizeContents(const gfx::Size& size);
- // Causes the renderer to invoke the onbeforeunload event handler. The
- // result will be returned via ViewMsg_ShouldClose.
- virtual void FirePageBeforeUnload();
-
- // Close the page after the page has responded that it can be closed via
- // ViewMsg_ShouldClose. This is where the page itself is closed. The
- // unload handler is triggered here, which can block with a dialog, but cannot
- // cancel the close of the page.
- virtual void FirePageUnload();
-
// TabContents
virtual WebContents* AsWebContents() { return this; }
virtual SiteInstance* GetSiteInstance() const {
@@ -91,17 +81,14 @@ class WebContents : public TabContents,
virtual bool IsFindWindowFullyVisible();
virtual bool GetFindInPageWindowLocation(int* x, int* y);
- // Text zoom
- virtual void AlterTextSize(text_zoom::TextSize size);
-
- // Change encoding of page.
- virtual void SetPageEncoding(const std::wstring& encoding_name);
-
bool is_starred() const { return is_starred_; }
// Set whether the contents should block javascript message boxes or not.
// Default is not to block any message boxes.
- void SetSuppressJavascriptMessageBoxes(bool suppress_javascript_messages);
+ void set_suppress_javascript_messages(
+ bool suppress_javascript_messages) {
+ suppress_javascript_messages_ = suppress_javascript_messages;
+ }
// Various other systems need to know about our interstitials.
bool showing_interstitial_page() const {
@@ -115,8 +102,8 @@ class WebContents : public TabContents,
// shown.
void SetDownloadShelfVisible(bool visible);
- // Returns the SavePackage which manages the page saving job.
- SavePackage* get_save_package() const { return save_package_.get(); }
+ // Returns the SavePackage which manages the page saving job. May be NULL.
+ SavePackage* save_package() const { return save_package_.get(); }
// Whether or not the info bar is visible. This delegates to
// the ChromeFrame method InfoBarVisibilityChanged.
@@ -138,41 +125,6 @@ class WebContents : public TabContents,
void SavePage(const std::wstring& main_file, const std::wstring& dir_path,
SavePackage::SavePackageType save_type);
- // Get all savable resource links from current webpage, include main
- // frame and sub-frame.
- void GetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
-
- // Get html data by serializing all frames of current page with lists
- // which contain all resource links that have local copy.
- // The parameter links contain original URLs of all saved links.
- // The parameter local_paths contain corresponding local file paths of
- // all saved links, which matched with vector:links one by one.
- // The parameter local_directory_name is relative path of directory which
- // contain all saved auxiliary files included all sub frames and resouces.
- void GetSerializedHtmlDataForCurrentPageWithLocalLinks(
- const std::vector<std::wstring>& links,
- const std::vector<std::wstring>& local_paths,
- const std::wstring& local_directory_name);
-
- // Locates a sub frame with given xpath and executes the given
- // javascript in its context.
- void ExecuteJavascriptInWebFrame(const std::wstring& frame_xpath,
- const std::wstring& jscript);
-
- // Locates a sub frame with given xpath and logs a message to its
- // console.
- void AddMessageToConsole(const std::wstring& frame_xpath,
- const std::wstring& message,
- ConsoleMessageLevel level);
-
- // Request the corresponding render view to perform these operations
- void Undo();
- void Redo();
- void Replace(const std::wstring& text);
- void AddToDictionary(const std::wstring& word);
- void Delete();
- void SelectAll();
-
// Sets the WebApp for this WebContents.
void SetWebApp(WebApp* web_app);
WebApp* web_app() { return web_app_.get(); }
@@ -183,51 +135,10 @@ class WebContents : public TabContents,
// Tell Gears to create a shortcut for the current page.
void CreateShortcut();
- // Tell the render view to perform a file upload. |form| is the name or ID of
- // the form that should be used to perform the upload. |file| is the name or
- // ID of the file input that should be set to |file_path|. |submit| is the
- // name or ID of the submit button. If non empty, the submit button will be
- // pressed. If not, the form will be filled with the information but the user
- // will perform the post operation.
- //
- // |other_values| contains a list of key value pairs separated by '\n'.
- // Each key value pair is of the form key=value where key is a form name or
- // ID and value is the desired value.
- void StartFileUpload(const std::wstring& file_path,
- const std::wstring& form,
- const std::wstring& file,
- const std::wstring& submit,
- const std::wstring& other_values);
-
// JavascriptMessageBoxHandler calls this when the dialog is closed.
void OnJavaScriptMessageBoxClosed(IPC::Message* reply_msg, bool success,
const std::wstring& prompt);
- void CopyImageAt(int x, int y);
- void InspectElementAt(int x, int y);
- void ShowJavaScriptConsole();
- void AllowDomAutomationBindings();
-
- // Tell the render view to fill in a form and optionally submit it.
- void FillForm(const FormData& form);
-
- // Tell the render view to fill a password form and trigger autocomplete
- // in the case of multiple matching logins.
- void FillPasswordForm(const PasswordFormDomManager::FillData& form_data);
-
- // D&d drop target messages that get forwarded on to the render view host.
- void DragTargetDragEnter(const WebDropData& drop_data,
- const gfx::Point& client_pt,
- const gfx::Point& screen_pt);
- void DragTargetDragOver(const gfx::Point& client_pt,
- const gfx::Point& screen_pt);
- void DragTargetDragLeave();
- void DragTargetDrop(const gfx::Point& client_pt,
- const gfx::Point& screen_pt);
-
- // Called by PluginInstaller to start installation of missing plugin.
- void InstallMissingPlugin();
-
// Returns the PasswordManager, creating it if necessary.
PasswordManager* GetPasswordManager();
@@ -330,7 +241,9 @@ class WebContents : public TabContents,
virtual ~WebContents();
// RenderViewHostDelegate
- virtual RenderViewHostDelegate::FindInPage* GetFindInPageDelegate();
+ virtual RenderViewHostDelegate::FindInPage* GetFindInPageDelegate() const;
+ virtual RenderViewHostDelegate::Save* GetSaveDelegate() const;
+
virtual Profile* GetProfile() const;
virtual void CreateView(int route_id, HANDLE modal_dialog_event);
@@ -415,13 +328,6 @@ class WebContents : public TabContents,
virtual void OnMissingPluginStatus(int status);
virtual void OnCrashedPlugin(const std::wstring& plugin_path);
virtual void OnJSOutOfMemory();
- virtual void OnReceivedSavableResourceLinksForCurrentPage(
- const std::vector<GURL>& resources_list,
- const std::vector<GURL>& referrers_list,
- const std::vector<GURL>& frames_list);
- virtual void OnReceivedSerializedHtmlData(const GURL& frame_url,
- const std::string& data,
- int32 status);
virtual void ShouldClosePage(bool proceed) {
render_manager_.ShouldClosePage(proceed);
}
diff --git a/chrome/browser/web_drop_target.cc b/chrome/browser/web_drop_target.cc
index 023c4ba..d072b72 100644
--- a/chrome/browser/web_drop_target.cc
+++ b/chrome/browser/web_drop_target.cc
@@ -106,7 +106,7 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object,
POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt);
- web_contents_->DragTargetDragEnter(drop_data,
+ web_contents_->render_view_host()->DragTargetDragEnter(drop_data,
gfx::Point(client_pt.x, client_pt.y),
gfx::Point(cursor_position.x, cursor_position.y));
@@ -124,7 +124,7 @@ DWORD WebDropTarget::OnDragOver(IDataObject* data_object,
POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt);
- web_contents_->DragTargetDragOver(
+ web_contents_->render_view_host()->DragTargetDragOver(
gfx::Point(client_pt.x, client_pt.y),
gfx::Point(cursor_position.x, cursor_position.y));
@@ -138,7 +138,7 @@ void WebDropTarget::OnDragLeave(IDataObject* data_object) {
if (web_contents_->showing_interstitial_page()) {
interstitial_drop_target_->OnDragLeave(data_object);
} else {
- web_contents_->DragTargetDragLeave();
+ web_contents_->render_view_host()->DragTargetDragLeave();
}
}
@@ -152,7 +152,7 @@ DWORD WebDropTarget::OnDrop(IDataObject* data_object,
POINT client_pt = cursor_position;
ScreenToClient(GetHWND(), &client_pt);
- web_contents_->DragTargetDrop(
+ web_contents_->render_view_host()->DragTargetDrop(
gfx::Point(client_pt.x, client_pt.y),
gfx::Point(cursor_position.x, cursor_position.y));