summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-03 01:09:53 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-03 01:09:53 +0000
commite94980027dc5cd1fb34950cddc18c629328a7e5b (patch)
tree3f0a131b5776c7e5fe2725c616a631933391c6f5
parente74d4e35ec4d0d235f1aa08846e36b1e96ad0327 (diff)
downloadchromium_src-e94980027dc5cd1fb34950cddc18c629328a7e5b.zip
chromium_src-e94980027dc5cd1fb34950cddc18c629328a7e5b.tar.gz
chromium_src-e94980027dc5cd1fb34950cddc18c629328a7e5b.tar.bz2
first stab at scaffolding WebContents.
Review URL: http://codereview.chromium.org/19757 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9055 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc8
-rw-r--r--chrome/browser/browser.h2
-rw-r--r--chrome/browser/browser.scons1
-rw-r--r--chrome/browser/browser_prefs.cc10
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h5
-rw-r--r--chrome/browser/tab_contents/web_contents.cc85
-rw-r--r--chrome/browser/tab_contents/web_contents.h32
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj2
-rw-r--r--chrome/common/l10n_util.cc2
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc38
-rw-r--r--chrome/common/temp_scaffolding_stubs.h426
11 files changed, 524 insertions, 87 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index d3b2d67..96d088c 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents_type.h"
+#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
@@ -187,12 +188,8 @@ Browser::Browser(Type type, Profile* profile)
InitCommandState();
BrowserList::AddBrowser(this);
-#if defined(OS_WIN)
- // TODO(port): turn this back on when prefs are fleshed out. This asserts
- // because the pref hasn't yet been registered.
encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector,
profile_->GetPrefs(), NULL);
-#endif
// Trim browser memory on idle for low & medium memory models.
if (g_browser_process->memory_model() < BrowserProcess::HIGH_MEMORY_MODEL)
@@ -999,6 +996,7 @@ void Browser::OpenHelpTab() {
NULL);
}
+#endif
///////////////////////////////////////////////////////////////////////////////
// static
@@ -1043,8 +1041,6 @@ Browser* Browser::GetBrowserForController(
return NULL;
}
-#endif // OS_WIN
-
///////////////////////////////////////////////////////////////////////////////
// Browser, CommandUpdater::CommandUpdaterDelegate implementation:
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index ce81f5c..d16a6b8 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -302,6 +302,7 @@ class Browser : public TabStripModelDelegate,
void OpenPasswordManager();
void OpenAboutChromeDialog();
void OpenHelpTab();
+#endif
/////////////////////////////////////////////////////////////////////////////
@@ -317,7 +318,6 @@ class Browser : public TabStripModelDelegate,
const NavigationController* controller, int* index);
// Interface implementations ////////////////////////////////////////////////
-#endif
// Overridden from CommandUpdater::CommandUpdaterDelegate:
virtual void ExecuteCommand(int id);
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index c82db3b..14b33e9 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -797,7 +797,6 @@ if not env.Bit('windows'):
'tab_contents/tab_contents_factory.cc',
'tab_contents/tab_util.cc',
'tab_contents/view_source_contents.cc',
- 'tab_contents/web_contents.cc',
'tab_contents/web_contents_view.cc',
'tab_contents/web_drag_source.cc',
'tab_contents/web_drop_target.cc',
diff --git a/chrome/browser/browser_prefs.cc b/chrome/browser/browser_prefs.cc
index da18c3f..faf0408 100644
--- a/chrome/browser/browser_prefs.cc
+++ b/chrome/browser/browser_prefs.cc
@@ -5,8 +5,9 @@
#include "chrome/browser/browser_prefs.h"
#include "chrome/browser/browser.h"
-#include "chrome/browser/session_startup_pref.h"
#include "chrome/browser/google_url_tracker.h"
+#include "chrome/browser/session_startup_pref.h"
+#include "chrome/browser/tab_contents/web_contents.h"
#if defined(OS_WIN)
#include "chrome/browser/browser_shutdown.h"
@@ -28,7 +29,6 @@
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/keyword_editor_view.h"
#include "chrome/browser/views/page_info_window.h"
-#include "chrome/browser/tab_contents/web_contents.h"
#endif
namespace browser {
@@ -36,9 +36,9 @@ namespace browser {
void RegisterAllPrefs(PrefService* user_prefs, PrefService* local_state) {
// Prefs in Local State
GoogleURLTracker::RegisterPrefs(local_state);
+ Browser::RegisterPrefs(local_state);
#if defined(OS_WIN)
BookmarkManagerView::RegisterPrefs(local_state);
- Browser::RegisterPrefs(local_state);
BrowserView::RegisterBrowserViewPrefs(local_state);
browser_shutdown::RegisterPrefs(local_state);
CacheManagerHost::RegisterPrefs(local_state);
@@ -54,18 +54,18 @@ void RegisterAllPrefs(PrefService* user_prefs, PrefService* local_state) {
// User prefs
SessionStartupPref::RegisterUserPrefs(user_prefs);
+ Browser::RegisterUserPrefs(user_prefs);
#if defined(OS_WIN)
BookmarkBarView::RegisterUserPrefs(user_prefs);
BookmarkTableView::RegisterUserPrefs(user_prefs);
- Browser::RegisterUserPrefs(user_prefs);
chrome_browser_net::RegisterUserPrefs(user_prefs);
DownloadManager::RegisterUserPrefs(user_prefs);
PasswordManager::RegisterUserPrefs(user_prefs);
SSLManager::RegisterUserPrefs(user_prefs);
TabContents::RegisterUserPrefs(user_prefs);
TemplateURLPrepopulateData::RegisterUserPrefs(user_prefs);
- WebContents::RegisterUserPrefs(user_prefs);
#endif
+ WebContents::RegisterUserPrefs(user_prefs);
}
} // namespace browser
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index 764e8ca..5a39b91 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "chrome/browser/autofill_manager.h"
#include "chrome/common/render_messages.h"
+#include "net/base/load_states.h"
#include "webkit/glue/webpreferences.h"
class NavigationEntry;
@@ -34,10 +35,6 @@ namespace gfx {
class Rect;
}
-namespace net {
-enum LoadState;
-}
-
//
// RenderViewHostDelegate
//
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index 039ddc2..849ba2a 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -8,20 +8,36 @@
#include "base/compiler_specific.h"
#include "base/file_version_info.h"
#include "base/process_util.h"
+#include "base/string_util.h"
#include "chrome/app/locales/locale_settings.h"
+#include "chrome/browser/browser.h"
+#include "chrome/browser/dom_operation_notification_details.h"
+#include "chrome/browser/google_util.h"
+#include "chrome/browser/js_before_unload_handler.h"
+#include "chrome/browser/jsmessage_box_handler.h"
+#include "chrome/browser/load_from_memory_cache_details.h"
+#include "chrome/browser/profile.h"
+#include "chrome/browser/renderer_host/render_process_host.h"
+#include "chrome/browser/tab_contents/provisional_load_details.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/pref_service.h"
+#include "net/base/mime_util.h"
+#include "net/base/net_errors.h"
+#include "net/base/registry_controlled_domain.h"
+#include "webkit/glue/webkit_glue.h"
+
+#if defined(OS_WIN)
+// TODO(port): fill these in as we flesh out the implementation of this class
#include "chrome/browser/autofill_manager.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
-#include "chrome/browser/browser.h"
#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/character_encoding.h"
-#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_request_manager.h"
#include "chrome/browser/gears_integration.h"
-#include "chrome/browser/google_util.h"
-#include "chrome/browser/js_before_unload_handler.h"
-#include "chrome/browser/jsmessage_box_handler.h"
-#include "chrome/browser/load_from_memory_cache_details.h"
#include "chrome/browser/load_notification_details.h"
#include "chrome/browser/modal_html_dialog_delegate.h"
#include "chrome/browser/password_manager/password_manager.h"
@@ -35,13 +51,8 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/web_contents_view.h"
#include "chrome/browser/views/hung_renderer_view.h" // TODO(brettw) delete me.
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/l10n_util.h"
-#include "chrome/common/notification_service.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
-#include "net/base/registry_controlled_domain.h"
+#endif
#include "generated_resources.h"
@@ -105,8 +116,8 @@ const int kJavascriptMessageExpectedDelay = 1000;
// shown for us to hide it when navigating away from the current page.
const int kDownloadShelfHideDelay = 5000;
-const wchar_t kLinkDoctorBaseURL[] =
- L"http://linkhelp.clients.google.com/tbproxy/lh/fixurl";
+const char kLinkDoctorBaseURL[] =
+ "http://linkhelp.clients.google.com/tbproxy/lh/fixurl";
// The printer icon in shell32.dll. That's a standard icon user will quickly
// recognize.
@@ -138,14 +149,6 @@ const int kPrefsToObserveLength = arraysize(kPrefsToObserve);
// text input element in a form.
const int kMaxAutofillMenuItems = 6;
-void InitWebContentsClass() {
- static bool web_contents_class_initialized = false;
- if (!web_contents_class_initialized) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- web_contents_class_initialized = true;
- }
-}
-
// Returns true if the entry's transition type is FORM_SUBMIT.
bool IsFormSubmit(const NavigationEntry* entry) {
return (PageTransition::StripQualifier(entry->transition_type()) ==
@@ -182,15 +185,16 @@ WebContents::WebContents(Profile* profile,
ALLOW_THIS_IN_INITIALIZER_LIST(
render_manager_(render_view_factory, this, this)),
render_view_factory_(render_view_factory),
- received_page_title_(false),
- is_starred_(false),
printing_(*this),
notify_disconnection_(false),
+ received_page_title_(false),
+ is_starred_(false),
+#if defined(OS_WIN)
message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)),
+#endif
ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)),
suppress_javascript_messages_(false),
load_state_(net::LOAD_STATE_IDLE) {
- InitWebContentsClass();
pending_install_.page_id = 0;
pending_install_.callback_functor = NULL;
@@ -344,9 +348,15 @@ std::wstring WebContents::GetStatusText() const {
case net::LOAD_STATE_SENDING_REQUEST:
return l10n_util::GetString(IDS_LOAD_STATE_SENDING_REQUEST);
case net::LOAD_STATE_WAITING_FOR_RESPONSE:
+#if defined(OS_WIN)
+ // TODO(port): GetStringF() is currently disabled for non-win platforms.
return l10n_util::GetStringF(IDS_LOAD_STATE_WAITING_FOR_RESPONSE,
load_state_host_);
+#endif
// Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE
+ case net::LOAD_STATE_IDLE:
+ case net::LOAD_STATE_READING_RESPONSE:
+ break;
}
return std::wstring();
@@ -475,6 +485,7 @@ void WebContents::PopupNotificationVisibilityChanged(bool visible) {
render_view_host()->PopupNotificationVisibilityChanged(visible);
}
+#if defined(OS_WIN)
// Stupid view pass-throughs
void WebContents::CreateView() {
view_->CreateView();
@@ -488,6 +499,7 @@ HWND WebContents::GetContentHWND() {
void WebContents::GetContainerBounds(gfx::Rect *out) const {
view_->GetContainerBounds(out);
}
+#endif
void WebContents::CreateShortcut() {
NavigationEntry* entry = controller()->GetLastCommittedEntry();
@@ -726,7 +738,6 @@ void WebContents::UpdateTitle(RenderViewHost* rvh,
NotifyNavigationStateChanged(INVALIDATE_TITLE);
}
-
void WebContents::UpdateEncoding(RenderViewHost* render_view_host,
const std::wstring& encoding) {
set_encoding(encoding);
@@ -827,7 +838,7 @@ void WebContents::DidLoadResourceFromMemoryCache(
return;
// Send out a notification that we loaded a resource from our memory cache.
- int cert_id, cert_status, security_bits;
+ int cert_id = 0, cert_status = 0, security_bits = 0;
SSLManager::DeserializeSecurityInfo(security_info,
&cert_id, &cert_status,
&security_bits);
@@ -1095,11 +1106,16 @@ void WebContents::PageHasOSDD(RenderViewHost* render_view_host,
// Download the OpenSearch description document. If this is successful a
// new keyword will be created when done.
+#if defined(OS_WIN)
+ gfx::NativeView ancestor = GetAncestor(view_->GetNativeView(), GA_ROOT);
+#else
+ gfx::NativeView ancestor = NULL;
+#endif
profile()->GetTemplateURLFetcher()->ScheduleDownload(
keyword,
url,
base_entry->favicon().url(),
- GetAncestor(view_->GetNativeView(), GA_ROOT),
+ ancestor,
autodetected);
}
@@ -1215,10 +1231,15 @@ WebPreferences WebContents::GetWebkitPrefs() {
}
void WebContents::OnMissingPluginStatus(int status) {
+#if defined(OS_WIN)
+// TODO(PORT): pull in when plug-ins work
GetPluginInstaller()->OnMissingPluginStatus(status);
+#endif
}
void WebContents::OnCrashedPlugin(const FilePath& plugin_path) {
+#if defined(OS_WIN)
+// TODO(PORT): pull in when plug-ins work
DCHECK(!plugin_path.value().empty());
std::wstring plugin_name = plugin_path.ToWStringHack();
@@ -1232,6 +1253,7 @@ void WebContents::OnCrashedPlugin(const FilePath& plugin_path) {
AddInfoBar(new SimpleAlertInfoBarDelegate(
this, l10n_util::GetStringF(IDS_PLUGIN_CRASHED_PROMPT, plugin_name),
NULL));
+#endif
}
void WebContents::OnJSOutOfMemory() {
@@ -1286,19 +1308,25 @@ void WebContents::OnDidGetApplicationInfo(
if (pending_install_.page_id != page_id)
return; // The user clicked create on a separate page. Ignore this.
+#if defined(OS_WIN)
+ // TODO(port): include when gears integration is ported
pending_install_.callback_functor =
new GearsCreateShortcutCallbackFunctor(this);
GearsCreateShortcut(
info, pending_install_.title, pending_install_.url, pending_install_.icon,
NewCallback(pending_install_.callback_functor,
&GearsCreateShortcutCallbackFunctor::Run));
+#endif
}
void WebContents::OnEnterOrSpace() {
// See comment in RenderViewHostDelegate::OnEnterOrSpace as to why we do this.
+#if defined(OS_WIN)
+ // TODO(port): this is stubbed in BrowserProcess
DownloadRequestManager* drm = g_browser_process->download_request_manager();
if (drm)
drm->OnUserGesture(this);
+#endif
}
bool WebContents::CanTerminate() const {
@@ -1317,7 +1345,6 @@ void WebContents::MultiFilesSelected(const std::vector<std::wstring>& files,
render_view_host()->MultiFilesSelected(files);
}
-
void WebContents::FileSelectionCanceled(void* params) {
// If the user cancels choosing a file to upload we pass back an
// empty vector.
diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h
index 39bf2c6..99f3c8c 100644
--- a/chrome/browser/tab_contents/web_contents.h
+++ b/chrome/browser/tab_contents/web_contents.h
@@ -5,28 +5,54 @@
#ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_H_
#define CHROME_BROWSER_TAB_CONTENTS_WEB_CONTENTS_H_
+#include "base/basictypes.h"
+#include "base/hash_tables.h"
+#include "chrome/browser/cancelable_request.h"
+#include "net/base/load_states.h"
+#include "webkit/glue/password_form.h"
+#include "webkit/glue/webpreferences.h"
+
+#if defined(OS_MACOSX) || defined(OS_LINUX)
+// Remove when we've finished porting the supporting classes.
+#include "chrome/common/temp_scaffolding_stubs.h"
+#elif defined(OS_WIN)
#include "chrome/browser/download/save_package.h"
#include "chrome/browser/fav_icon_helper.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
-#include "chrome/browser/tab_contents/render_view_host_manager.h"
#include "chrome/browser/shell_dialogs.h"
+#include "chrome/browser/tab_contents/render_view_host_manager.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/gears_api.h"
+#endif
+class AutofillForm;
class AutofillManager;
class InterstitialPageDelegate;
+class LoadNotificationDetails;
class PasswordManager;
class PluginInstaller;
+class RenderProcessHost;
class RenderViewHost;
class RenderViewHostFactory;
class RenderWidgetHost;
+struct ThumbnailScore;
+struct ViewHostMsg_FrameNavigate_Params;
+struct ViewHostMsg_DidPrintPage_Params;
class WebContentsView;
namespace base {
class WaitableEvent;
}
+namespace webkit_glue {
+struct WebApplicationInfo;
+}
+
+namespace IPC {
+class Message;
+}
+
// WebContents represents the contents of a tab that shows web pages. It embeds
// a RenderViewHost (via RenderViewHostManager) to actually display the page.
class WebContents : public TabContents,
@@ -101,6 +127,7 @@ class WebContents : public TabContents,
virtual void SetDownloadShelfVisible(bool visible);
virtual void PopupNotificationVisibilityChanged(bool visible);
+#if defined(OS_WIN)
// Retarded pass-throughs to the view.
// TODO(brettw) fix this, tab contents shouldn't have these methods, probably
// it should be killed altogether.
@@ -108,6 +135,7 @@ class WebContents : public TabContents,
virtual HWND GetContainerHWND() const;
virtual HWND GetContentHWND();
virtual void GetContainerBounds(gfx::Rect *out) const;
+#endif
// Web apps ------------------------------------------------------------------
@@ -503,10 +531,12 @@ class WebContents : public TabContents,
// Whether the current URL is starred
bool is_starred_;
+#if defined(OS_WIN)
// Handle to an event that's set when the page is showing a message box (or
// equivalent constrained window). Plugin processes check this to know if
// they should pump messages then.
ScopedHandle message_box_active_;
+#endif
// AutofillManager, lazily created.
scoped_ptr<AutofillManager> autofill_manager_;
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 045efe0..7d98b2b 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -274,6 +274,7 @@
E40CC5F70F2E351A00708647 /* bookmark_table_model.cc in Sources */ = {isa = PBXBuildFile; fileRef = E40CC5F60F2E351A00708647 /* bookmark_table_model.cc */; };
E40CC5FE0F2E35A800708647 /* security_filter_peer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBFA0E9D4C9F009A6919 /* security_filter_peer.cc */; };
E42155D80F3240AF00A4A951 /* tab_strip_view.mm in Sources */ = {isa = PBXBuildFile; fileRef = E433E65E0F323E2100CAC3AC /* tab_strip_view.mm */; };
+ E434B9060F37672900B665C7 /* web_contents.cc in Sources */ = {isa = PBXBuildFile; fileRef = B6CCB9EF0F1EC32700106F0D /* web_contents.cc */; };
E43A770B0F1660EA00ABD5D1 /* automation_resource_tracker.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48FB9680EC4EA270052B72B /* automation_resource_tracker.cc */; };
E43A770D0F16610300ABD5D1 /* chrome_plugin_browsing_context.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF85B0E9D4839009A6919 /* chrome_plugin_browsing_context.cc */; };
E43A77110F16613700ABD5D1 /* chrome_url_request_context.cc in Sources */ = {isa = PBXBuildFile; fileRef = E43A77100F16613700ABD5D1 /* chrome_url_request_context.cc */; };
@@ -4602,6 +4603,7 @@
4D7BFA430E9D491E009A6919 /* visit_tracker.cc in Sources */,
B5FCDE5C0F269E9B0099BFAF /* visitedlink_master.cc in Sources */,
4D7BFA480E9D4922009A6919 /* visitsegment_database.cc in Sources */,
+ E434B9060F37672900B665C7 /* web_contents.cc in Sources */,
E48B6C3C0F27844F002E47EC /* web_data_service.cc in Sources */,
E45076200F150E0C003BE099 /* web_database.cc in Sources */,
);
diff --git a/chrome/common/l10n_util.cc b/chrome/common/l10n_util.cc
index 86a36eb..562c205 100644
--- a/chrome/common/l10n_util.cc
+++ b/chrome/common/l10n_util.cc
@@ -324,7 +324,7 @@ std::wstring GetString(int message_id) {
return rb.GetLocalizedString(message_id);
#else
NOTIMPLEMENTED(); // TODO(port): Real implementation of GetString.
- return L"";
+ return L"true";
#endif
}
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index e0824c4..38e8ff0 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -12,12 +12,14 @@
#include "build/build_config.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_shutdown.h"
+#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/first_run.h"
#include "chrome/browser/history/in_memory_history_backend.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/rlz/rlz.h"
#include "chrome/browser/shell_integration.h"
+#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/notification_service.h"
@@ -137,7 +139,12 @@ void Browser::LoadingStateChanged(TabContents* source) {
TabContents* TabContents::CreateWithType(TabContentsType type,
Profile* profile,
SiteInstance* instance) {
- return new TabContents;
+ switch (type) {
+ case TAB_CONTENTS_WEB:
+ return new WebContents(profile, instance, NULL, MSG_ROUTING_NONE, NULL);
+ default:
+ return NULL;
+ }
}
//--------------------------------------------------------------------------
@@ -180,3 +187,32 @@ namespace chrome_browser_net {
void EnableDnsPrefetch(bool) {}
} // namespace chrome_browser_net
+
+//--------------------------------------------------------------------------
+
+void RunJavascriptMessageBox(WebContents* web_contents,
+ int dialog_flags,
+ const std::wstring& message_text,
+ const std::wstring& default_prompt_text,
+ bool display_suppress_checkbox,
+ IPC::Message* reply_msg) {
+}
+
+CacheManagerHost::CacheManagerHost() : revise_allocation_factory_(this) { }
+CacheManagerHost::~CacheManagerHost() { }
+
+void CacheManagerHost::ObserveActivity(int) {
+}
+
+CacheManagerHost* CacheManagerHost::GetInstance() {
+ return Singleton<CacheManagerHost>::get();
+}
+
+void RunBeforeUnloadDialog(WebContents* web_contents,
+ const std::wstring& message_text,
+ IPC::Message* reply_msg) {
+}
+
+bool SSLManager::DeserializeSecurityInfo(const std::string&, int*, int*, int*) {
+ return false;
+}
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index edc6b5c..6b73c97 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -18,28 +18,37 @@
#include "base/gfx/rect.h"
#include "chrome/browser/bookmarks/bookmark_service.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/cache_manager_host.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/tab_contents/tab_contents_type.h"
-#include "chrome/common/ipc_message.h"
+#include "chrome/common/navigation_types.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
+#include "chrome/common/render_messages.h"
#include "googleurl/src/gurl.h"
#include "skia/include/SkBitmap.h"
+#include "webkit/glue/password_form.h"
#include "webkit/glue/window_open_disposition.h"
class Browser;
class BookmarkService;
class CommandLine;
+class ConstrainedWindow;
+class DownloadManager;
class HistoryService;
class MetricsService;
+class ModalHtmlDialogDelegate;
class NavigationController;
class NavigationEntry;
class NotificationService;
class ProfileManager;
class Profile;
+class RenderProcessHost;
class SessionID;
class SiteInstance;
class SpellChecker;
class TabContents;
+struct ThumbnailScore;
class Task;
class TemplateURL;
class TemplateURLRef;
@@ -48,6 +57,10 @@ class UserScriptMaster;
class VisitedLinkMaster;
class WebContents;
+namespace IPC {
+class Message;
+}
+
//---------------------------------------------------------------------------
// These stubs are for Browser_main()
@@ -127,14 +140,15 @@ class TabRestoreService : public base::RefCountedThreadSafe<TabRestoreService> {
class HistoryService {
public:
-
class URLEnumerator {
public:
virtual ~URLEnumerator() {}
virtual void OnURL(const GURL& url) = 0;
virtual void OnComplete(bool success) = 0;
};
-
+ class Handle {
+ public:
+ };
HistoryService() {}
HistoryService(Profile* profile) {}
bool Init(const FilePath& history_dir, BookmarkService* bookmark_service)
@@ -148,6 +162,9 @@ class HistoryService {
void Cleanup() {}
void AddRef() {}
void Release() {}
+ void SetFavIconOutOfDateForPage(const GURL&) {}
+ void SetPageThumbnail(const GURL&, const SkBitmap&, const ThumbnailScore&) {}
+ void SetPageTitle(const GURL&, const std::wstring&) { }
};
namespace history {
@@ -275,28 +292,93 @@ class AcceleratorHandler {
//---------------------------------------------------------------------------
// These stubs are for Browser
-class SavePackage {
+class RenderViewHostDelegate {
public:
- static bool IsSavableContents(const std::string& contents_mime_type) {
- return false;
- }
+ class View {
+ public:
+ };
+ class Save {
+ public:
+ };
+};
+
+class SavePackage : public base::RefCountedThreadSafe<SavePackage>,
+ public RenderViewHostDelegate::Save {
+ public:
+ enum SavePackageType {
+ SAVE_AS_ONLY_HTML = 0,
+ SAVE_AS_COMPLETE_HTML = 1
+ };
+ struct SavePackageParam {
+ SavePackageParam(const std::string&) { }
+ const std::string current_tab_mime_type;
+ PrefService* prefs;
+ SavePackageType save_type;
+ std::wstring saved_main_file_path;
+ std::wstring dir;
+ };
+ static bool IsSavableContents(const std::string&) { return false; }
static bool IsSavableURL(const GURL& url) { return false; }
+ static std::wstring GetSuggestNameForSaveAs(PrefService*,
+ const std::wstring&) {
+ return L"";
+ }
+ static bool GetSaveInfo(const std::wstring&, void*,
+ SavePackageParam*, DownloadManager*) { return false; }
+ SavePackage(WebContents*, SavePackageType, const std::wstring&,
+ const std::wstring&) { }
+ bool Init() { return true; }
};
class DebuggerWindow : public base::RefCountedThreadSafe<DebuggerWindow> {
public:
};
+class FaviconStatus {
+ public:
+ const GURL& url() const { return url_; }
+ private:
+ GURL url_;
+};
+
class NavigationEntry {
public:
const GURL& url() const { return url_; }
+ PageTransition::Type transition_type() const {
+ return PageTransition::LINK;
+ }
+ int page_id() { return 0; }
+ SiteInstance* site_instance() const { return NULL; }
+ std::string content_state() const { return ""; }
+ void set_content_state(const std::string&) { }
+ void set_display_url(const GURL&) { }
+ bool has_display_url() const { return false; }
+ const GURL& display_url() const { return url_; }
+ void set_url(const GURL& url) { url_ = url; }
+ TabContentsType tab_type() const { return TAB_CONTENTS_WEB; }
+ const GURL& user_typed_url() const { return url_; }
+ const FaviconStatus& favicon() const { return favicon_status_; }
+ std::wstring title() { return L""; }
+ void set_title(const std::wstring&) { }
private:
GURL url_;
+ FaviconStatus favicon_status_;
};
class NavigationController {
public:
- NavigationController() : entry_(new NavigationEntry) { }
+ struct LoadCommittedDetails {
+ NavigationEntry* entry;
+ bool is_main_frame;
+ GURL previous_url;
+ NavigationType::Type type;
+ bool is_auto;
+ bool is_in_page;
+ bool is_content_filtered;
+ std::string serialized_security_info;
+ bool is_user_initiated_main_frame_load() const { return true; }
+ };
+ NavigationController() : entry_(new NavigationEntry()) { }
virtual ~NavigationController() { }
bool CanGoBack() const { return false; }
bool CanGoForward() const { return false; }
@@ -309,17 +391,45 @@ class NavigationController {
NavigationEntry* GetActiveEntry() const { return entry_.get(); }
void LoadURL(const GURL& url, const GURL& referrer,
PageTransition::Type type) { }
- static void DisablePromptOnRepost() {}
-
+ NavigationEntry* GetPendingEntry() { return entry_.get(); }
+ bool RendererDidNavigate(const ViewHostMsg_FrameNavigate_Params&,
+ LoadCommittedDetails*) { return true; }
+ int GetEntryIndexWithPageID(TabContentsType, SiteInstance*,
+ int32) const { return 0; }
+ NavigationEntry* GetEntryWithPageID(TabContentsType, SiteInstance*,
+ int32) const { return entry_.get(); }
+ NavigationEntry* GetEntryAtIndex(int index) const { return entry_.get(); }
+ NavigationEntry* GetEntryAtOffset(int index) const { return entry_.get(); }
+ int GetLastCommittedEntryIndex() const { return 0; }
+ int GetEntryCount() const { return 1; }
+ int GetCurrentEntryIndex() const { return 0; }
+ void NotifyEntryChanged(NavigationEntry*, int) { }
+ bool IsURLInPageNavigation(const GURL&) { return false; }
+ void DiscardNonCommittedEntries() { }
+ void GoToOffset(int) { }
+ static void DisablePromptOnRepost() { }
+ int max_restored_page_id() { return 0; }
private:
scoped_ptr<NavigationEntry> entry_;
};
class TabContentsDelegate {
public:
- virtual void OpenURL(const GURL& url, const GURL& referrer,
- WindowOpenDisposition disposition,
- PageTransition::Type transition) { }
+ virtual void OpenURL(const GURL&, const GURL&, WindowOpenDisposition,
+ PageTransition::Type) { }
+ virtual void UpdateTargetURL(TabContents*, const GURL&) { }
+ virtual void CloseContents(TabContents*) { }
+ virtual void MoveContents(TabContents*, const gfx::Rect&) { }
+ virtual bool IsPopup(TabContents*) { return false; }
+ virtual void ForwardMessageToExternalHost(const std::string&,
+ const std::string&) { }
+ virtual TabContents* GetConstrainingContents(TabContents*) { return NULL; }
+ virtual void ShowHtmlDialog(ModalHtmlDialogDelegate*, void*) { }
+ virtual bool CanBlur() { return true; }
+ virtual bool IsExternalTabContainer() { return false; }
+ virtual void BeforeUnloadFired(WebContents*, bool, bool*) { }
+ virtual void URLStarredChanged(WebContents*, bool) { }
+ virtual void ConvertContentsToApplication(WebContents*) { }
};
class InterstitialPage {
@@ -341,15 +451,64 @@ class ConfirmInfoBarDelegate : public InfoBarDelegate {
};
};
-class RenderViewHost {
+class RenderWidgetHostView {
public:
- bool HasUnloadListener() const { return false; }
- void FirePageBeforeUnload() { }
+ virtual void DidBecomeSelected() { }
+ virtual bool WasHidden() { return false; }
+ virtual void SetSize(gfx::Size) { }
+};
+
+class RenderWidgetHost {
+ public:
+ RenderWidgetHost() : process_(), view_() { }
+ RenderProcessHost* process() const { return process_; }
+ RenderWidgetHostView* view() const { return view_; }
+ private:
+ RenderProcessHost* process_;
+ RenderWidgetHostView* view_;
};
-class TabContents {
+class RenderViewHost : public RenderWidgetHost {
public:
- TabContents() : controller_(new NavigationController) { }
+ bool HasUnloadListener() const { return false; }
+ void FirePageBeforeUnload() { }
+ void SetPageEncoding(const std::wstring& encoding) { }
+ SiteInstance* site_instance() const { return NULL; }
+ void NavigateToEntry(const NavigationEntry& entry, bool is_reload) { }
+ void Cut() { }
+ void Copy() { }
+ void Paste() { }
+ void DisassociateFromPopupCount() { }
+ void PopupNotificationVisibilityChanged(bool) { }
+ void GetApplicationInfo(int32 page_id) { }
+ bool PrintPages() { return false; }
+ void SetInitialFocus(bool) { }
+ void UnloadListenerHasFired() { }
+ bool IsRenderViewLive() { return true; }
+ void FileSelected(const std::wstring&) { }
+ void MultiFilesSelected(const std::vector<std::wstring>&) { }
+ bool CreateRenderView() { return true; }
+ void SetAlternateErrorPageURL(const GURL&) { }
+ void UpdateWebPreferences(WebPreferences) { }
+ void ReservePageIDRange(int) { }
+};
+
+class LoadNotificationDetails {
+ public:
+ LoadNotificationDetails(const GURL&, PageTransition::Type,
+ base::TimeDelta, NavigationController*, int) { }
+};
+
+class TabContents : public NotificationObserver {
+ public:
+ enum InvalidateTypes {
+ INVALIDATE_URL = 1,
+ INVALIDATE_TITLE = 2,
+ INVALIDATE_FAVICON = 4,
+ INVALIDATE_LOAD = 8,
+ INVALIDATE_EVERYTHING = 0xFFFFFFFF
+ };
+ TabContents(TabContentsType) : controller_(new NavigationController) { }
virtual ~TabContents() { }
NavigationController* controller() const { return controller_.get(); }
virtual WebContents* AsWebContents() const { return NULL; }
@@ -360,6 +519,7 @@ class TabContents {
virtual void Focus() { }
virtual void Stop() { }
bool is_loading() const { return false; }
+ Profile* profile() const { return NULL; }
void CloseContents() { };
void SetupController(Profile* profile) { }
bool WasHidden() { return false; }
@@ -368,43 +528,56 @@ class TabContents {
static TabContents* CreateWithType(TabContentsType type,
Profile* profile,
SiteInstance* instance);
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) { }
+ virtual void DidBecomeSelected() { }
+ virtual void SetDownloadShelfVisible(bool) { }
+ void Destroy() { }
+ virtual void SetIsLoading(bool, LoadNotificationDetails*) { }
+ virtual void SetIsCrashed(bool) { }
+ bool capturing_contents() const { return false; }
+ void set_capturing_contents(bool) { }
+ bool is_active() { return false; }
+ void SetNotWaitingForResponse() { }
+ void NotifyNavigationStateChanged(int) { }
+ TabContentsDelegate* delegate() const { return NULL; }
void AddInfoBar(InfoBarDelegate* delegate) {}
-
- Profile* profile() const { return NULL; }
+ void OpenURL(const GURL&, const GURL&, WindowOpenDisposition,
+ PageTransition::Type) { }
+ protected:
+ typedef std::vector<ConstrainedWindow*> ConstrainedWindowList;
+ ConstrainedWindowList child_windows_;
private:
GURL url_;
std::wstring title_;
scoped_ptr<NavigationController> controller_;
};
-class WebContents : public TabContents {
- public:
- WebContents* AsWebContents() { return this; }
- bool showing_interstitial_page() const { return false; }
- InterstitialPage* interstitial_page() const { return NULL; }
- bool is_starred() const { return false; }
- const std::string& contents_mime_type() const { return mime_type_; }
- bool notify_disconnection() const { return false; }
- RenderViewHost* render_view_host() const {
- return const_cast<RenderViewHost*>(&render_view_host_);
- }
-
- private:
- RenderViewHost render_view_host_;
-
- std::string mime_type_;
-};
-
class SelectFileDialog : public base::RefCountedThreadSafe<SelectFileDialog> {
public:
+ enum Type {
+ SELECT_FOLDER,
+ SELECT_SAVEAS_FILE,
+ SELECT_OPEN_FILE,
+ SELECT_OPEN_MULTI_FILE
+ };
class Listener {
public:
};
void ListenerDestroyed() { }
+ void SelectFile(Type, const std::wstring&, const std::wstring&,
+ const std::wstring&, const std::wstring&, gfx::NativeView,
+ void*) {}
+ static SelectFileDialog* Create(WebContents*) { return new SelectFileDialog; }
};
class SiteInstance {
public:
+ bool has_site() { return false; }
+ void SetSite(const GURL&) { }
+ int max_page_id() { return 0; }
+ void UpdateMaxPageID(int) { }
};
class DockInfo {
@@ -431,12 +604,17 @@ class WindowSizer {
class DownloadManager : public base::RefCountedThreadSafe<DownloadManager> {
public:
bool Init(Profile* profile) { return true; }
+ void DownloadUrl(const GURL& url, const GURL& referrer,
+ WebContents* web_contents) { }
+ int in_progress_count() { return 0; }
};
class TemplateURLFetcher {
public:
explicit TemplateURLFetcher(Profile* profile) { }
bool Init(Profile* profile) { return true; }
+ void ScheduleDownload(const std::wstring&, const GURL&, const GURL&,
+ const gfx::NativeView, bool) { }
};
namespace base {
@@ -503,6 +681,178 @@ class TemplateURLModel {
}
static GURL GenerateSearchURL(const TemplateURL* t_url) { return GURL(); }
TemplateURL* GetDefaultSearchProvider() { return NULL; }
+ bool loaded() const { return false; }
+ void Load() { }
+ TemplateURL* GetTemplateURLForKeyword(const std::wstring&) { return NULL; }
+ void ScheduleDownload(const std::wstring&, const GURL&, const GURL&,
+ const gfx::NativeView, bool) { }
+ bool CanReplaceKeyword(const std::wstring&, const std::wstring&,
+ const TemplateURL**) {
+ return false;
+ }
+ void Remove(const TemplateURL*) { }
+ void Add(const TemplateURL*) { }
+};
+
+//---------------------------------------------------------------------------
+// These stubs are for WebContents
+
+class WebContentsView : public RenderViewHostDelegate::View {
+ public:
+ void OnContentsDestroy() { }
+ void* GetNativeView() { return NULL; }
+ void HideFindBar(bool) { }
+ void Invalidate() { }
+ static WebContentsView* Create(WebContents*) { return new WebContentsView; }
+ gfx::NativeView GetTopLevelNativeView() const { return NULL; }
+ gfx::Size GetContainerSize() const { return gfx::Size(); }
+ void SizeContents(const gfx::Size& size) { }
+ RenderWidgetHostView* CreateViewForWidget(RenderWidgetHost*) {
+ return NULL;
+ }
+ void RenderWidgetHostDestroyed(RenderWidgetHost*) { }
+ void SetPageTitle(const std::wstring&) { }
+};
+
+class WebContentsViewWin : public WebContentsView {
+ public:
+ WebContentsViewWin(WebContents*) { }
+};
+
+class RenderViewHostFactory {
+ public:
+};
+
+class RenderViewHostManager {
+ public:
+ class Delegate {
+ public:
+ };
+ RenderViewHostManager(RenderViewHostFactory*, RenderViewHostDelegate*,
+ Delegate* delegate)
+ : render_view_host_(new RenderViewHost), interstitial_page_() { }
+ RenderViewHost* current_host() const { return render_view_host_; }
+ void Init(Profile*, SiteInstance*, int, base::WaitableEvent*) { }
+ void Shutdown() { }
+ InterstitialPage* interstitial_page() const {
+ return interstitial_page_;
+ }
+ void set_interstitial_page(InterstitialPage* interstitial_page) {
+ interstitial_page_ = interstitial_page;
+ }
+ void remove_interstitial_page() { interstitial_page_ = NULL; }
+ RenderWidgetHostView* current_view() const {
+ if (!render_view_host_) return NULL;
+ return render_view_host_->view();
+ }
+ void CrossSiteNavigationCanceled() { }
+ void ShouldClosePage(bool) { }
+ void OnCrossSiteResponse(int, int) { }
+ RenderViewHost* Navigate(const NavigationEntry&) { return render_view_host_; }
+ void Stop() { }
+ void OnJavaScriptMessageBoxClosed(IPC::Message*, bool,
+ const std::wstring&) { }
+ void SetIsLoading(bool) { }
+ void DidNavigateMainFrame(RenderViewHost*) { }
+ void RendererAbortedProvisionalLoad(RenderViewHost*) { }
+ bool ShouldCloseTabOnUnresponsiveRenderer() { return false; }
+ private:
+ RenderViewHost* render_view_host_;
+ InterstitialPage* interstitial_page_;
+};
+
+class WebApp : public base::RefCountedThreadSafe<WebApp> {
+ public:
+ class Observer {
+ public:
+ };
+ void AddObserver(Observer* obs) { }
+ void RemoveObserver(Observer* obs) { }
+ void SetWebContents(WebContents*) { }
+ SkBitmap GetFavIcon() { return SkBitmap(); }
+};
+
+class GearsShortcutData {
+ public:
+};
+
+namespace printing {
+class PrintViewManager {
+ public:
+ PrintViewManager(WebContents&) { }
+ void Stop() { }
+ void Destroy() { }
+ bool OnRendererGone(RenderViewHost*) { return false; }
+ void DidGetPrintedPagesCount(int, int) { }
+ void DidPrintPage(const ViewHostMsg_DidPrintPage_Params&) { }
+};
+}
+
+class FavIconHelper {
+ public:
+ FavIconHelper(WebContents*) { }
+ void SetFavIconURL(const GURL&) { }
+ void SetFavIcon(int, const GURL&, const SkBitmap&) { }
+ void FavIconDownloadFailed(int) { }
+ void FetchFavIcon(const GURL&) { }
+};
+
+class AutofillManager {
+ public:
+ AutofillManager(WebContents*) { }
+ void AutofillFormSubmitted(const AutofillForm&) { }
+ void FetchValuesForName(const std::wstring&, const std::wstring&, int,
+ int64, int) { }
+};
+
+class PasswordManager {
+ public:
+ PasswordManager(WebContents*) { }
+ void ClearProvisionalSave() { }
+ void DidStopLoading() { }
+ void PasswordFormsSeen(const std::vector<PasswordForm>&) { }
+ void DidNavigate() { }
+ void ProvisionallySavePassword(PasswordForm form) { }
+};
+
+class PluginInstaller {
+ public:
+ PluginInstaller(WebContents*) { }
+};
+
+class HungRendererWarning {
+ public:
+ static void HideForWebContents(WebContents*) { }
+ static void ShowForWebContents(WebContents*) { }
+};
+
+class ConstrainedWindow {
+ public:
+ bool WasHidden() { return false; }
+ void DidBecomeSelected() { }
+ void CloseConstrainedWindow() { }
+};
+
+class SSLManager {
+ public:
+ static bool DeserializeSecurityInfo(const std::string&, int*, int*, int*);
+};
+
+class ModalHtmlDialogDelegate {
+ public:
+ ModalHtmlDialogDelegate(const GURL&, int, int, const std::string&,
+ IPC::Message*, WebContents*) { }
+};
+
+class CharacterEncoding {
+ public:
+ static std::wstring GetCanonicalEncodingNameByAliasName(
+ const std::wstring&) { return L""; }
+};
+
+class SimpleAlertInfoBarDelegate : public InfoBarDelegate {
+ public:
+ SimpleAlertInfoBarDelegate(WebContents*, const std::wstring&, void*) {}
};
#endif // CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_