summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-01-07 14:18:56 +0000
committerBen Murdoch <benm@google.com>2011-01-11 10:23:13 +0000
commit201ade2fbba22bfb27ae029f4d23fca6ded109a0 (patch)
treeb793f4ed916f73cf18357ea467ff3deb5ffb5b52 /chrome/browser/tab_contents
parentd8c4c37a7d0961944bfdfaa117d5c68c8e129c97 (diff)
downloadexternal_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.zip
external_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.tar.gz
external_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.tar.bz2
Merge chromium at 9.0.597.55: Initial merge by git.
Change-Id: Id686a88437441ec7e17abb3328a404c7b6c3c6ad
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/navigation_controller.cc6
-rw-r--r--chrome/browser/tab_contents/navigation_controller.h2
-rw-r--r--chrome/browser/tab_contents/navigation_controller_unittest.cc12
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc7
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.h8
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager.cc2
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc225
-rw-r--r--chrome/browser/tab_contents/tab_contents.h51
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.cc17
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h16
-rw-r--r--chrome/browser/tab_contents/tab_specific_content_settings.cc20
-rw-r--r--chrome/browser/tab_contents/tab_specific_content_settings.h9
-rw-r--r--chrome/browser/tab_contents/tab_specific_content_settings_unittest.cc18
-rw-r--r--chrome/browser/tab_contents/web_drag_dest_gtk.cc6
-rw-r--r--chrome/browser/tab_contents/web_drag_dest_gtk.h4
-rw-r--r--chrome/browser/tab_contents/web_drop_target_win.cc10
-rw-r--r--chrome/browser/tab_contents/web_navigation_observer.h59
17 files changed, 291 insertions, 181 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
index 918a9b4..fac26a3 100644
--- a/chrome/browser/tab_contents/navigation_controller.cc
+++ b/chrome/browser/tab_contents/navigation_controller.cc
@@ -980,8 +980,10 @@ void NavigationController::CopyStateFromAndPrune(NavigationController* source) {
// Take over the session id from source.
session_id_ = source->session_id_;
- // Reset source's session id as we're taking it over.
- source->session_id_.clear();
+ // Reset source's session id as we're taking it over. We give it a new id in
+ // case source is added later on, which can happen with instant enabled if the
+ // tab has a before unload handler.
+ source->session_id_ = SessionID();
}
void NavigationController::PruneAllButActive() {
diff --git a/chrome/browser/tab_contents/navigation_controller.h b/chrome/browser/tab_contents/navigation_controller.h
index f9c284e..d86b587 100644
--- a/chrome/browser/tab_contents/navigation_controller.h
+++ b/chrome/browser/tab_contents/navigation_controller.h
@@ -372,8 +372,6 @@ class NavigationController {
// this: E F *G* (last must be active or pending)
// result: A B *G*
// This ignores the transient index of the source and honors that of 'this'.
- // This should only be used when you are going to destroy |source| right after
- // invoking this.
void CopyStateFromAndPrune(NavigationController* source);
// Removes all the entries except the active entry. If there is a new pending
diff --git a/chrome/browser/tab_contents/navigation_controller_unittest.cc b/chrome/browser/tab_contents/navigation_controller_unittest.cc
index 81010a9..b8cfcb5 100644
--- a/chrome/browser/tab_contents/navigation_controller_unittest.cc
+++ b/chrome/browser/tab_contents/navigation_controller_unittest.cc
@@ -1740,9 +1740,9 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune) {
EXPECT_EQ(url3, other_controller.GetEntryAtIndex(2)->url());
// The session id of the new tab should be that of the old, and the old should
- // be set to 0.
+ // get a new id.
EXPECT_EQ(id.id(), other_controller.session_id().id());
- EXPECT_EQ(0, controller().session_id().id());
+ EXPECT_NE(id.id(), controller().session_id().id());
}
// Test CopyStateFromAndPrune with 2 urls, the first selected and nothing in
@@ -1770,9 +1770,9 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune2) {
EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url());
// The session id of the new tab should be that of the old, and the old should
- // be set to 0.
+ // get a new id.
EXPECT_EQ(id.id(), other_controller.session_id().id());
- EXPECT_EQ(0, controller().session_id().id());
+ EXPECT_NE(id.id(), controller().session_id().id());
}
// Test CopyStateFromAndPrune with 2 urls, the first selected and nothing in
@@ -1807,9 +1807,9 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune3) {
EXPECT_EQ(url3, other_controller.pending_entry()->url());
// The session id of the new tab should be that of the old, and the old should
- // be set to 0.
+ // be get a new id.
EXPECT_EQ(id.id(), other_controller.session_id().id());
- EXPECT_EQ(0, controller().session_id().id());
+ EXPECT_NE(id.id(), controller().session_id().id());
}
// Tests that navigations initiated from the page (with the history object)
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index 8c8754d..c7f59ff 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -188,6 +188,8 @@ void RenderViewHostDelegateViewHelper::RenderWidgetHostDestroyed(
}
}
+bool RenderViewHostDelegateHelper::gpu_enabled_ = true;
+
// static
WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
Profile* profile, bool is_dom_ui) {
@@ -271,6 +273,7 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
web_prefs.databases_enabled =
!command_line.HasSwitch(switches::kDisableDatabases);
web_prefs.experimental_webgl_enabled =
+ gpu_enabled() &&
!command_line.HasSwitch(switches::kDisableExperimentalWebGL);
web_prefs.site_specific_quirks_enabled =
!command_line.HasSwitch(switches::kDisableSiteSpecificQuirks);
@@ -279,9 +282,13 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
web_prefs.show_composited_layer_borders =
command_line.HasSwitch(switches::kShowCompositedLayerBorders);
web_prefs.accelerated_compositing_enabled =
+ gpu_enabled() &&
!command_line.HasSwitch(switches::kDisableAcceleratedCompositing);
web_prefs.accelerated_2d_canvas_enabled =
+ gpu_enabled() &&
command_line.HasSwitch(switches::kEnableAccelerated2dCanvas);
+ web_prefs.accelerated_layers_enabled =
+ command_line.HasSwitch(switches::kEnableAcceleratedLayers);
web_prefs.memory_info_enabled =
command_line.HasSwitch(switches::kEnableMemoryInfo);
web_prefs.hyperlink_auditing_enabled =
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.h b/chrome/browser/tab_contents/render_view_host_delegate_helper.h
index 372b234..d4ea3a3 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h
@@ -104,9 +104,17 @@ class RenderViewHostDelegateHelper {
const std::string& value);
static void ClearInspectorSettings(Profile* profile);
+ static bool gpu_enabled() { return gpu_enabled_; }
+ static void set_gpu_enabled(bool enabled) { gpu_enabled_ = enabled; }
+
private:
RenderViewHostDelegateHelper();
+ // Master switch for enabling/disabling GPU acceleration for the current
+ // browser session. It does not change the acceleration settings for
+ // existing tabs, just the future ones.
+ static bool gpu_enabled_;
+
DISALLOW_COPY_AND_ASSIGN(RenderViewHostDelegateHelper);
};
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc
index 664b7f5..c9e6373 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager.cc
@@ -495,6 +495,8 @@ void RenderViewHostManager::CommitPending() {
// Next commit the DOM UI, if any.
dom_ui_.swap(pending_dom_ui_);
+ if (dom_ui_.get() && pending_dom_ui_.get() && !pending_render_view_host_)
+ dom_ui_->DidBecomeActiveForReusedRenderView();
pending_dom_ui_.reset();
// It's possible for the pending_render_view_host_ to be NULL when we aren't
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 26b77ce..67acf2f 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -55,7 +55,6 @@
#include "chrome/browser/metrics/metric_event_duration_details.h"
#include "chrome/browser/modal_html_dialog_delegate.h"
#include "chrome/browser/omnibox_search_hint.h"
-#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/plugin_installer.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -82,6 +81,7 @@
#include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/tab_contents/thumbnail_generator.h"
+#include "chrome/browser/tab_contents/web_navigation_observer.h"
#include "chrome/browser/translate/page_translated_details.h"
#include "chrome/common/bindings_policy.h"
#include "chrome/common/chrome_switches.h"
@@ -330,7 +330,6 @@ TabContents::TabContents(Profile* profile,
save_package_(),
autocomplete_history_manager_(),
autofill_manager_(),
- password_manager_(),
plugin_installer_(),
bookmark_drag_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)),
@@ -487,8 +486,13 @@ TabContents::~TabContents() {
#if defined(OS_WIN)
// If we still have a window handle, destroy it. GetNativeView can return
// NULL if this contents was part of a window that closed.
- if (GetNativeView())
+ if (GetNativeView()) {
+ RenderViewHost* host = render_view_host();
+ if (host && host->view()) {
+ host->view()->WillWmDestroy();
+ }
::DestroyWindow(GetNativeView());
+ }
#endif
// OnCloseStarted isn't called in unit tests.
@@ -566,12 +570,6 @@ AutoFillManager* TabContents::GetAutoFillManager() {
return autofill_manager_.get();
}
-PasswordManager* TabContents::GetPasswordManager() {
- if (password_manager_.get() == NULL)
- password_manager_.reset(new PasswordManager(this));
- return password_manager_.get();
-}
-
PluginInstaller* TabContents::GetPluginInstaller() {
if (plugin_installer_.get() == NULL)
plugin_installer_.reset(new PluginInstaller(this));
@@ -605,12 +603,13 @@ void TabContents::SetExtensionAppById(const std::string& extension_app_id) {
return;
ExtensionsService* extension_service = profile()->GetExtensionsService();
- if (extension_service && extension_service->is_ready()) {
- const Extension* extension =
- extension_service->GetExtensionById(extension_app_id, false);
- if (extension)
- SetExtensionApp(extension);
- }
+ if (!extension_service || !extension_service->is_ready())
+ return;
+
+ const Extension* extension =
+ extension_service->GetExtensionById(extension_app_id, false);
+ if (extension)
+ SetExtensionApp(extension);
}
SkBitmap* TabContents::GetExtensionAppIcon() {
@@ -767,6 +766,14 @@ std::wstring TabContents::GetStatusText() const {
return std::wstring();
}
+void TabContents::AddNavigationObserver(WebNavigationObserver* observer) {
+ web_navigation_observers_.AddObserver(observer);
+}
+
+void TabContents::RemoveNavigationObserver(WebNavigationObserver* observer) {
+ web_navigation_observers_.RemoveObserver(observer);
+}
+
void TabContents::SetIsCrashed(bool state) {
if (state == is_crashed_)
return;
@@ -795,6 +802,20 @@ void TabContents::DidBecomeSelected() {
}
WebCacheManager::GetInstance()->ObserveActivity(GetRenderProcessHost()->id());
+ last_selected_time_ = base::TimeTicks::Now();
+}
+
+void TabContents::FadeForInstant(bool animate) {
+ RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
+ SkColor whitish = SkColorSetARGB(192, 255, 255, 255);
+ if (rwhv)
+ rwhv->SetVisuallyDeemphasized(&whitish, animate);
+}
+
+void TabContents::CancelInstantFade() {
+ RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
+ if (rwhv)
+ rwhv->SetVisuallyDeemphasized(NULL, false);
}
void TabContents::WasHidden() {
@@ -841,6 +862,13 @@ void TabContents::HideContents() {
WasHidden();
}
+bool TabContents::NeedToFireBeforeUnload() {
+ // TODO(creis): Should we fire even for interstitial pages?
+ return notify_disconnection() &&
+ !showing_interstitial_page() &&
+ !render_view_host()->SuddenTerminationAllowed();
+}
+
void TabContents::OpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition,
PageTransition::Type transition) {
@@ -887,6 +915,10 @@ bool TabContents::NavigateToEntry(
// Navigate in the desired RenderViewHost.
ViewMsg_Navigate_Params navigate_params;
MakeNavigateParams(entry, controller_, reload_type, &navigate_params);
+ if (delegate_) {
+ navigate_params.extra_headers =
+ delegate_->GetNavigationHeaders(navigate_params.url);
+ }
dest_render_view_host->Navigate(navigate_params);
if (entry.page_id() == -1) {
@@ -899,10 +931,9 @@ bool TabContents::NavigateToEntry(
return false;
}
- // Clear any provisional password saves - this stops password infobars
- // showing up on pages the user navigates to while the right page is
- // loading.
- GetPasswordManager()->ClearProvisionalSave();
+ // Notify observers about navigation.
+ FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
+ NavigateToPendingEntry());
if (reload_type != NavigationController::NO_RELOAD &&
!profile()->IsOffTheRecord()) {
@@ -962,8 +993,10 @@ ConstrainedWindow* TabContents::CreateConstrainedDialog(
void TabContents::BlockTabContent(bool blocked) {
RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
+ // 70% opaque grey.
+ SkColor greyish = SkColorSetARGB(178, 0, 0, 0);
if (rwhv)
- rwhv->SetVisuallyDeemphasized(blocked);
+ rwhv->SetVisuallyDeemphasized(blocked ? &greyish : NULL, false);
render_view_host()->set_ignore_input_events(blocked);
if (delegate_)
delegate_->SetTabContentBlocked(this, blocked);
@@ -1642,13 +1675,6 @@ void TabContents::DidNavigateMainFramePostCommit(
// clear the bubble when a user navigates to a named anchor in the same
// page.
UpdateTargetURL(details.entry->page_id(), GURL());
-
- // UpdateHelpersForDidNavigate will handle the case where the password_form
- // origin is valid.
- // TODO(brettw) bug 1343111: Password manager stuff in here needs to be
- // cleaned up and covered by tests.
- if (!params.password_form.origin.is_valid())
- GetPasswordManager()->DidNavigate();
}
// The keyword generator uses the navigation entries, so must be called after
@@ -1710,6 +1736,10 @@ void TabContents::DidNavigateMainFramePostCommit(
// Update the starred state.
UpdateStarredStateForCurrentURL();
+ // Notify observers about navigation.
+ FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
+ DidNavigateMainFramePostCommit(details, params));
+
// Clear the cache of forms in AutoFill.
if (autofill_manager_.get())
autofill_manager_->Reset();
@@ -1724,11 +1754,9 @@ void TabContents::DidNavigateAnyFramePostCommit(
// reload the page to stop blocking.
suppress_javascript_messages_ = false;
- // Notify the password manager of the navigation or form submit.
- // TODO(brettw) bug 1343111: Password manager stuff in here needs to be
- // cleaned up and covered by tests.
- if (params.password_form.origin.is_valid())
- GetPasswordManager()->ProvisionallySavePassword(params.password_form);
+ // Notify observers about navigation.
+ FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
+ DidNavigateAnyFramePostCommit(details, params));
// Let the LanguageState clear its state.
language_state_.DidNavigate(details);
@@ -2064,6 +2092,11 @@ void TabContents::OnDidGetApplicationInfo(int32 page_id,
delegate()->OnDidGetApplicationInfo(this, page_id);
}
+void TabContents::OnInstallApplication(const WebApplicationInfo& info) {
+ if (delegate())
+ delegate()->OnInstallApplication(this, info);
+}
+
void TabContents::OnDisabledOutdatedPlugin(const string16& name,
const GURL& update_url) {
new DisabledPluginInfoBar(this, name, update_url);
@@ -2640,10 +2673,15 @@ void TabContents::RequestMove(const gfx::Rect& new_bounds) {
void TabContents::DidStartLoading() {
SetIsLoading(true, NULL);
+
if (content_restrictions_) {
content_restrictions_= 0;
delegate()->ContentRestrictionsChanged(this);
}
+
+ // Notify observers about navigation.
+ FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
+ DidStartLoading());
}
void TabContents::DidStopLoading() {
@@ -2663,11 +2701,11 @@ void TabContents::DidStopLoading() {
controller_.GetCurrentEntryIndex()));
}
- // Tell PasswordManager we've finished a page load, which serves as a
- // green light to save pending passwords and reset itself.
- GetPasswordManager()->DidStopLoading();
-
SetIsLoading(false, details.get());
+
+ // Notify observers about navigation.
+ FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
+ DidStopLoading());
}
void TabContents::DocumentOnLoadCompletedInMainFrame(
@@ -2745,8 +2783,10 @@ void TabContents::RunJavaScriptMessage(
// Also suppress messages when showing an interstitial. The interstitial is
// shown over the previous page, we don't want the hidden page dialogs to
// interfere with the interstitial.
- bool suppress_this_message = suppress_javascript_messages_ ||
- showing_interstitial_page();
+ bool suppress_this_message =
+ suppress_javascript_messages_ ||
+ showing_interstitial_page() ||
+ (delegate() && delegate()->ShouldSuppressDialogs());
if (delegate())
suppress_this_message |=
(delegate()->GetConstrainingContents(this) != this);
@@ -2774,6 +2814,13 @@ void TabContents::RunJavaScriptMessage(
void TabContents::RunBeforeUnloadConfirm(const std::wstring& message,
IPC::Message* reply_msg) {
+ if (delegate())
+ delegate()->WillRunBeforeUnloadConfirm();
+ if (delegate() && delegate()->ShouldSuppressDialogs()) {
+ render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true,
+ std::wstring());
+ return;
+ }
is_showing_before_unload_dialog_ = true;
RunBeforeUnloadDialog(this, message, reply_msg);
}
@@ -2791,12 +2838,14 @@ void TabContents::ShowModalHTMLDialog(const GURL& url, int width, int height,
void TabContents::PasswordFormsFound(
const std::vector<webkit_glue::PasswordForm>& forms) {
- GetPasswordManager()->PasswordFormsFound(forms);
+ FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
+ PasswordFormsFound(forms));
}
void TabContents::PasswordFormsVisible(
const std::vector<webkit_glue::PasswordForm>& visible_forms) {
- GetPasswordManager()->PasswordFormsVisible(visible_forms);
+ FOR_EACH_OBSERVER(WebNavigationObserver, web_navigation_observers_,
+ PasswordFormsVisible(visible_forms));
}
// Checks to see if we should generate a keyword based on the OSDD, and if
@@ -3233,99 +3282,3 @@ void TabContents::SetAppIcon(const SkBitmap& app_icon) {
app_icon_ = app_icon;
NotifyNavigationStateChanged(INVALIDATE_TITLE);
}
-
-// After a successful *new* login attempt, we take the PasswordFormManager in
-// provisional_save_manager_ and move it to a SavePasswordInfoBarDelegate while
-// the user makes up their mind with the "save password" infobar. Note if the
-// login is one we already know about, the end of the line is
-// provisional_save_manager_ because we just update it on success and so such
-// forms never end up in an infobar.
-class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
- public:
- SavePasswordInfoBarDelegate(TabContents* tab_contents,
- PasswordFormManager* form_to_save)
- : ConfirmInfoBarDelegate(tab_contents),
- form_to_save_(form_to_save),
- infobar_response_(NO_RESPONSE) {}
-
- virtual ~SavePasswordInfoBarDelegate() {}
-
- // Begin ConfirmInfoBarDelegate implementation.
- virtual void InfoBarClosed() {
- UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse",
- infobar_response_, NUM_RESPONSE_TYPES);
- delete this;
- }
-
- virtual Type GetInfoBarType() { return PAGE_ACTION_TYPE; }
-
- virtual string16 GetMessageText() const {
- return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT);
- }
-
- virtual SkBitmap* GetIcon() const {
- return ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_INFOBAR_SAVE_PASSWORD);
- }
-
- virtual int GetButtons() const {
- return BUTTON_OK | BUTTON_CANCEL;
- }
-
- virtual string16 GetButtonLabel(InfoBarButton button) const {
- if (button == BUTTON_OK)
- return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON);
- if (button == BUTTON_CANCEL)
- return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON);
- NOTREACHED();
- return string16();
- }
-
- virtual bool Accept() {
- DCHECK(form_to_save_.get());
- form_to_save_->Save();
- infobar_response_ = REMEMBER_PASSWORD;
- return true;
- }
-
- virtual bool Cancel() {
- DCHECK(form_to_save_.get());
- form_to_save_->PermanentlyBlacklist();
- infobar_response_ = DONT_REMEMBER_PASSWORD;
- return true;
- }
- // End ConfirmInfoBarDelegate implementation.
-
- private:
- // The PasswordFormManager managing the form we're asking the user about,
- // and should update as per her decision.
- scoped_ptr<PasswordFormManager> form_to_save_;
-
- // Used to track the results we get from the info bar.
- enum ResponseType {
- NO_RESPONSE = 0,
- REMEMBER_PASSWORD,
- DONT_REMEMBER_PASSWORD,
- NUM_RESPONSE_TYPES,
- };
- ResponseType infobar_response_;
-
- DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate);
-};
-
-void TabContents::FillPasswordForm(
- const webkit_glue::PasswordFormFillData& form_data) {
- render_view_host()->FillPasswordForm(form_data);
-}
-
-void TabContents::AddSavePasswordInfoBar(PasswordFormManager* form_to_save) {
- AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save));
-}
-
-Profile* TabContents::GetProfileForPasswordManager() {
- return profile();
-}
-
-bool TabContents::DidLastPageLoadEncounterSSLErrors() {
- return controller().ssl_manager()->ProcessedSSLErrorFromRequest();
-}
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 8602255..04885a2 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
#pragma once
+<<<<<<< HEAD
#ifdef ANDROID
#include "android/autofill/profile_android.h"
#include "base/scoped_ptr.h"
@@ -42,6 +43,8 @@ private:
#include "build/build_config.h"
+=======
+>>>>>>> Chromium.org at 9.0.597.55
#include <deque>
#include <map>
#include <string>
@@ -59,7 +62,6 @@ private:
#include "chrome/browser/find_notification_details.h"
#include "chrome/browser/js_modal_dialog.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
-#include "chrome/browser/password_manager/password_manager_delegate.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/tab_contents/constrained_window.h"
#include "chrome/browser/tab_contents/language_state.h"
@@ -106,7 +108,6 @@ class FileSelectHelper;
class InfoBarDelegate;
class LoadNotificationDetails;
class OmniboxSearchHint;
-class PasswordManager;
class PluginInstaller;
class Profile;
struct RendererPreferences;
@@ -122,6 +123,7 @@ class URLPattern;
struct ThumbnailScore;
struct ViewHostMsg_DomMessage_Params;
struct ViewHostMsg_FrameNavigate_Params;
+class WebNavigationObserver;
struct WebPreferences;
// Describes what goes in the main content area of a tab. TabContents is
@@ -134,7 +136,6 @@ class TabContents : public PageNavigator,
public RenderViewHostManager::Delegate,
public JavaScriptAppModalDialogDelegate,
public ImageLoadingTracker::Observer,
- public PasswordManagerDelegate,
public TabSpecificContentSettings::Delegate {
public:
// Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it
@@ -191,9 +192,6 @@ class TabContents : public PageNavigator,
// Returns the AutoFillManager, creating it if necessary.
AutoFillManager* GetAutoFillManager();
- // Returns the PasswordManager, creating it if necessary.
- PasswordManager* GetPasswordManager();
-
// Returns the PluginInstaller, creating it if necessary.
PluginInstaller* GetPluginInstaller();
@@ -303,6 +301,13 @@ class TabContents : public PageNavigator,
// Returns a human-readable description the tab's loading state.
virtual std::wstring GetStatusText() const;
+ // Add and remove observers for page navigation notifications. Adding or
+ // removing multiple times has no effect. The order in which notifications
+ // are sent to observers is undefined. Clients must be sure to remove the
+ // observer before they go away.
+ void AddNavigationObserver(WebNavigationObserver* observer);
+ void RemoveNavigationObserver(WebNavigationObserver* observer);
+
// Return whether this tab contents is loading a resource.
bool is_loading() const { return is_loading_; }
@@ -360,6 +365,9 @@ class TabContents : public PageNavigator,
// Invoked when the tab contents becomes selected. If you override, be sure
// and invoke super's implementation.
virtual void DidBecomeSelected();
+ base::TimeTicks last_selected_time() const {
+ return last_selected_time_;
+ }
// Invoked when the tab contents becomes hidden.
// NOTE: If you override this, call the superclass version too!
@@ -376,6 +384,12 @@ class TabContents : public PageNavigator,
virtual void ShowContents();
virtual void HideContents();
+ // Returns true if the before unload and unload listeners need to be
+ // fired. The value of this changes over time. For example, if true and the
+ // before unload listener is executed and allows the user to exit, then this
+ // returns false.
+ bool NeedToFireBeforeUnload();
+
#ifdef UNIT_TEST
// Expose the render manager for testing.
RenderViewHostManager* render_manager() { return &render_manager_; }
@@ -729,13 +743,6 @@ class TabContents : public PageNavigator,
// state by various UI elements.
TabSpecificContentSettings* GetTabSpecificContentSettings() const;
- // PasswordManagerDelegate implementation.
- virtual void FillPasswordForm(
- const webkit_glue::PasswordFormFillData& form_data);
- virtual void AddSavePasswordInfoBar(PasswordFormManager* form_to_save);
- virtual Profile* GetProfileForPasswordManager();
- virtual bool DidLastPageLoadEncounterSSLErrors();
-
// Updates history with the specified navigation. This is called by
// OnMsgNavigate to update history state.
void UpdateHistoryForNavigation(
@@ -751,6 +758,12 @@ class TabContents : public PageNavigator,
// Gets the zoom percent for this tab.
int GetZoomPercent(bool* enable_increment, bool* enable_decrement);
+ // Shows a fade effect over this tab contents. Repeated calls will be ignored
+ // until the fade is canceled. If |animate| is true the fade should animate.
+ void FadeForInstant(bool animate);
+ // Immediately removes the fade.
+ void CancelInstantFade();
+
// Gets the minimum/maximum zoom percent.
int minimum_zoom_percent() const { return minimum_zoom_percent_; }
int maximum_zoom_percent() const { return maximum_zoom_percent_; }
@@ -904,6 +917,7 @@ class TabContents : public PageNavigator,
virtual void OnCrashedWorker();
virtual void OnDidGetApplicationInfo(int32 page_id,
const WebApplicationInfo& info);
+ virtual void OnInstallApplication(const WebApplicationInfo& info);
virtual void OnDisabledOutdatedPlugin(const string16& name,
const GURL& update_url);
virtual void OnPageContents(const GURL& url,
@@ -1129,9 +1143,6 @@ class TabContents : public PageNavigator,
// AutoFillManager, lazily created.
scoped_ptr<AutoFillManager> autofill_manager_;
- // PasswordManager, lazily created.
- scoped_ptr<PasswordManager> password_manager_;
-
// PluginInstaller, lazily created.
scoped_ptr<PluginInstaller> plugin_installer_;
@@ -1199,7 +1210,7 @@ class TabContents : public PageNavigator,
// used to check whether we can do something for some special contents.
std::string contents_mime_type_;
- // Character encoding. TODO(jungshik) : convert to std::string
+ // Character encoding.
std::string encoding_;
// Object that holds any blocked TabContents spawned from this TabContents.
@@ -1324,6 +1335,9 @@ class TabContents : public PageNavigator,
// The time that we started to close the tab.
base::TimeTicks tab_close_start_time_;
+ // The time that this tab was last selected.
+ base::TimeTicks last_selected_time_;
+
// Information about the language the page is in and has been translated to.
LanguageState language_state_;
@@ -1338,6 +1352,9 @@ class TabContents : public PageNavigator,
// remember it.
bool temporary_zoom_settings_;
+ // A list of observers notified when page state changes. Weak references.
+ ObserverList<WebNavigationObserver> web_navigation_observers_;
+
// Content restrictions, used to disable print/copy etc based on content's
// (full-page plugins for now only) permissions.
int content_restrictions_;
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.cc b/chrome/browser/tab_contents/tab_contents_delegate.cc
index 89eef5c..21c13ff 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.cc
+++ b/chrome/browser/tab_contents/tab_contents_delegate.cc
@@ -7,6 +7,10 @@
#include "chrome/browser/search_engines/template_url.h"
#include "gfx/rect.h"
+std::string TabContentsDelegate::GetNavigationHeaders(const GURL& url) {
+ return std::string();
+}
+
void TabContentsDelegate::DetachContents(TabContents* source) {
}
@@ -45,6 +49,13 @@ void TabContentsDelegate::ShowHtmlDialog(HtmlDialogUIDelegate* delegate,
gfx::NativeWindow parent_window) {
}
+void TabContentsDelegate::WillRunBeforeUnloadConfirm() {
+}
+
+bool TabContentsDelegate::ShouldSuppressDialogs() {
+ return false;
+}
+
void TabContentsDelegate::BeforeUnloadFired(TabContents* tab,
bool proceed,
bool* proceed_to_fire_unload) {
@@ -162,6 +173,12 @@ void TabContentsDelegate::OnDidGetApplicationInfo(TabContents* tab_contents,
int32 page_id) {
}
+// Notification when an application programmatically requests installation.
+void TabContentsDelegate::OnInstallApplication(
+ TabContents* tab_contents,
+ const WebApplicationInfo& app_info) {
+}
+
gfx::NativeWindow TabContentsDelegate::GetFrameNativeWindow() {
return NULL;
}
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index 5d9ee37..6a59741 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -38,6 +38,7 @@ class RenderViewHost;
class TabContents;
class TemplateURL;
class TemplateURLModel;
+struct WebApplicationInfo;
// Objects implement this interface to get notified about changes in the
// TabContents and to provide necessary functionality.
@@ -61,6 +62,10 @@ class TabContentsDelegate : public AutomationResourceRoutingDelegate {
virtual void NavigationStateChanged(const TabContents* source,
unsigned changed_flags) = 0;
+ // Returns the set of headers to add to the navigation request. Use
+ // net::HttpUtil::AppendHeaderIfMissing to build the set of headers.
+ virtual std::string GetNavigationHeaders(const GURL& url);
+
// Creates a new tab with the already-created TabContents 'new_contents'.
// The window for the added contents should be reparented correctly when this
// method returns. If |disposition| is NEW_POPUP, |pos| should hold the
@@ -153,6 +158,13 @@ class TabContentsDelegate : public AutomationResourceRoutingDelegate {
virtual void ShowHtmlDialog(HtmlDialogUIDelegate* delegate,
gfx::NativeWindow parent_window);
+ // Invoked prior to showing before unload handler confirmation dialog.
+ virtual void WillRunBeforeUnloadConfirm();
+
+ // Returns true if javascript dialogs and unload alerts are suppressed.
+ // Default is false.
+ virtual bool ShouldSuppressDialogs();
+
// Tells us that we've finished firing this tab's beforeunload event.
// The proceed bool tells us whether the user chose to proceed closing the
// tab. Returns true if the tab can continue on firing it's unload event.
@@ -274,6 +286,10 @@ class TabContentsDelegate : public AutomationResourceRoutingDelegate {
virtual void OnDidGetApplicationInfo(TabContents* tab_contents,
int32 page_id);
+ // Notification when an application programmatically requests installation.
+ virtual void OnInstallApplication(TabContents* tab_contents,
+ const WebApplicationInfo& app_info);
+
// Returns the native window framing the view containing the tab contents.
virtual gfx::NativeWindow GetFrameNativeWindow();
diff --git a/chrome/browser/tab_contents/tab_specific_content_settings.cc b/chrome/browser/tab_contents/tab_specific_content_settings.cc
index edafe6c..22550ea 100644
--- a/chrome/browser/tab_contents/tab_specific_content_settings.cc
+++ b/chrome/browser/tab_contents/tab_specific_content_settings.cc
@@ -40,6 +40,16 @@ bool TabSpecificContentSettings::IsContentBlocked(
return false;
}
+bool TabSpecificContentSettings::IsBlockageIndicated(
+ ContentSettingsType content_type) const {
+ return content_blockage_indicated_to_user_[content_type];
+}
+
+void TabSpecificContentSettings::SetBlockageHasBeenIndicated(
+ ContentSettingsType content_type) {
+ content_blockage_indicated_to_user_[content_type] = true;
+}
+
bool TabSpecificContentSettings::IsContentAccessed(
ContentSettingsType content_type) const {
// This method currently only returns meaningful values for cookies.
@@ -94,9 +104,10 @@ void TabSpecificContentSettings::OnContentAccessed(ContentSettingsType type) {
}
void TabSpecificContentSettings::OnCookieAccessed(
- const GURL& url, const std::string& cookie_line, bool blocked_by_policy) {
- net::CookieOptions options;
- options.set_include_httponly();
+ const GURL& url,
+ const std::string& cookie_line,
+ const net::CookieOptions& options,
+ bool blocked_by_policy) {
if (blocked_by_policy) {
blocked_local_shared_objects_.cookies()->SetCookieWithOptions(
url, cookie_line, options);
@@ -196,6 +207,7 @@ void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() {
blocked_resources_[i].reset();
content_blocked_[i] = false;
content_accessed_[i] = false;
+ content_blockage_indicated_to_user_[i] = false;
}
load_plugins_link_enabled_ = true;
if (delegate_)
@@ -207,12 +219,14 @@ void TabSpecificContentSettings::ClearCookieSpecificContentSettings() {
allowed_local_shared_objects_.Reset();
content_blocked_[CONTENT_SETTINGS_TYPE_COOKIES] = false;
content_accessed_[CONTENT_SETTINGS_TYPE_COOKIES] = false;
+ content_blockage_indicated_to_user_[CONTENT_SETTINGS_TYPE_COOKIES] = false;
if (delegate_)
delegate_->OnContentSettingsAccessed(false);
}
void TabSpecificContentSettings::SetPopupsBlocked(bool blocked) {
content_blocked_[CONTENT_SETTINGS_TYPE_POPUPS] = blocked;
+ content_blockage_indicated_to_user_[CONTENT_SETTINGS_TYPE_POPUPS] = false;
if (delegate_)
delegate_->OnContentSettingsAccessed(blocked);
}
diff --git a/chrome/browser/tab_contents/tab_specific_content_settings.h b/chrome/browser/tab_contents/tab_specific_content_settings.h
index 5cc9213..26685d1 100644
--- a/chrome/browser/tab_contents/tab_specific_content_settings.h
+++ b/chrome/browser/tab_contents/tab_specific_content_settings.h
@@ -64,6 +64,11 @@ class TabSpecificContentSettings
// page.
bool IsContentBlocked(ContentSettingsType content_type) const;
+ // Returns true if content blockage was indicated to the user.
+ bool IsBlockageIndicated(ContentSettingsType content_type) const;
+
+ void SetBlockageHasBeenIndicated(ContentSettingsType content_type);
+
// Returns whether a particular kind of content has been accessed. Currently
// only tracks cookies.
bool IsContentAccessed(ContentSettingsType content_type) const;
@@ -93,6 +98,7 @@ class TabSpecificContentSettings
const std::string& resource_identifier);
virtual void OnCookieAccessed(const GURL& url,
const std::string& cookie_line,
+ const net::CookieOptions& options,
bool blocked_by_policy);
virtual void OnIndexedDBAccessed(const GURL& url,
const string16& description,
@@ -159,6 +165,9 @@ class TabSpecificContentSettings
// Stores which content setting types actually have blocked content.
bool content_blocked_[CONTENT_SETTINGS_NUM_TYPES];
+ // Stores if the blocked content was messaged to the user.
+ bool content_blockage_indicated_to_user_[CONTENT_SETTINGS_NUM_TYPES];
+
// Stores which content setting types actually were accessed.
bool content_accessed_[CONTENT_SETTINGS_NUM_TYPES];
diff --git a/chrome/browser/tab_contents/tab_specific_content_settings_unittest.cc b/chrome/browser/tab_contents/tab_specific_content_settings_unittest.cc
index 64c84e4..5be081c 100644
--- a/chrome/browser/tab_contents/tab_specific_content_settings_unittest.cc
+++ b/chrome/browser/tab_contents/tab_specific_content_settings_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/tab_contents/tab_specific_content_settings.h"
#include "chrome/test/testing_profile.h"
+#include "net/base/cookie_options.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -39,6 +40,7 @@ TEST(TabSpecificContentSettingsTest, BlockedContent) {
TestContentSettingsDelegate test_delegate;
TestingProfile profile;
TabSpecificContentSettings content_settings(&test_delegate, &profile);
+ net::CookieOptions options;
// Check that after initializing, nothing is blocked.
EXPECT_FALSE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES));
@@ -51,7 +53,8 @@ TEST(TabSpecificContentSettingsTest, BlockedContent) {
EXPECT_FALSE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
// Set a cookie, block access to images, block a popup.
- content_settings.OnCookieAccessed(GURL("http://google.com"), "A=B", false);
+ content_settings.OnCookieAccessed(
+ GURL("http://google.com"), "A=B", options, false);
EXPECT_TRUE(test_delegate.SettingsChanged());
EXPECT_FALSE(test_delegate.ContentBlocked());
test_delegate.Reset();
@@ -74,10 +77,12 @@ TEST(TabSpecificContentSettingsTest, BlockedContent) {
EXPECT_FALSE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
EXPECT_TRUE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
- content_settings.OnCookieAccessed(GURL("http://google.com"), "A=B", false);
+ content_settings.OnCookieAccessed(
+ GURL("http://google.com"), "A=B", options, false);
// Block a cookie.
- content_settings.OnCookieAccessed(GURL("http://google.com"), "C=D", true);
+ content_settings.OnCookieAccessed(
+ GURL("http://google.com"), "C=D", options, true);
EXPECT_TRUE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
@@ -111,6 +116,7 @@ TEST(TabSpecificContentSettingsTest, AllowedContent) {
TestContentSettingsDelegate test_delegate;
TestingProfile profile;
TabSpecificContentSettings content_settings(&test_delegate, &profile);
+ net::CookieOptions options;
ASSERT_FALSE(
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_IMAGES));
@@ -118,12 +124,14 @@ TEST(TabSpecificContentSettingsTest, AllowedContent) {
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_FALSE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
- content_settings.OnCookieAccessed(GURL("http://google.com"), "A=B", false);
+ content_settings.OnCookieAccessed(
+ GURL("http://google.com"), "A=B", options, false);
ASSERT_TRUE(
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_FALSE(
content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
- content_settings.OnCookieAccessed(GURL("http://google.com"), "C=D", true);
+ content_settings.OnCookieAccessed(
+ GURL("http://google.com"), "C=D", options, true);
ASSERT_TRUE(
content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_TRUE(
diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.cc b/chrome/browser/tab_contents/web_drag_dest_gtk.cc
index 2c38987..eaede71 100644
--- a/chrome/browser/tab_contents/web_drag_dest_gtk.cc
+++ b/chrome/browser/tab_contents/web_drag_dest_gtk.cc
@@ -9,7 +9,7 @@
#include "app/gtk_dnd_util.h"
#include "base/file_path.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/bookmarks/bookmark_drag_data.h"
+#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/gtk/bookmark_utils_gtk.h"
#include "chrome/browser/gtk/gtk_util.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -28,11 +28,11 @@ namespace {
// gtk_dnd_util::CHROME_BOOKMARK_ITEM. See
// bookmark_utils::WriteBookmarksToSelection() for details.
// For Views, bookmark drag data is encoded in the same format, and
-// associated with a custom format. See BookmarkDragData::Write() for
+// associated with a custom format. See BookmarkNodeData::Write() for
// details.
GdkAtom GetBookmarkTargetAtom() {
#if defined(TOOLKIT_VIEWS)
- return BookmarkDragData::GetBookmarkCustomFormat();
+ return BookmarkNodeData::GetBookmarkCustomFormat();
#else
return gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::CHROME_BOOKMARK_ITEM);
#endif
diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.h b/chrome/browser/tab_contents/web_drag_dest_gtk.h
index 67d6852..4b85f9f 100644
--- a/chrome/browser/tab_contents/web_drag_dest_gtk.h
+++ b/chrome/browser/tab_contents/web_drag_dest_gtk.h
@@ -11,7 +11,7 @@
#include "app/gtk_signal.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
-#include "chrome/browser/bookmarks/bookmark_drag_data.h"
+#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
#include "webkit/glue/webdropdata.h"
@@ -84,7 +84,7 @@ class WebDragDestGtk {
// The bookmark data for the current tab. This will be empty if there is not
// a native bookmark drag (or we haven't gotten the data from the source yet).
- BookmarkDragData bookmark_drag_data_;
+ BookmarkNodeData bookmark_drag_data_;
ScopedRunnableMethodFactory<WebDragDestGtk> method_factory_;
diff --git a/chrome/browser/tab_contents/web_drop_target_win.cc b/chrome/browser/tab_contents/web_drop_target_win.cc
index e626181..d70b851 100644
--- a/chrome/browser/tab_contents/web_drop_target_win.cc
+++ b/chrome/browser/tab_contents/web_drop_target_win.cc
@@ -10,7 +10,7 @@
#include "app/clipboard/clipboard_util_win.h"
#include "app/os_exchange_data.h"
#include "app/os_exchange_data_provider_win.h"
-#include "chrome/browser/bookmarks/bookmark_drag_data.h"
+#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/web_drag_utils_win.h"
@@ -125,7 +125,7 @@ DWORD WebDropTarget::OnDragEnter(IDataObject* data_object,
// support for (at the moment experimental) drag and drop extensions.
if (tab_contents_->GetBookmarkDragDelegate()) {
OSExchangeData os_exchange_data(new OSExchangeDataProviderWin(data_object));
- BookmarkDragData bookmark_drag_data;
+ BookmarkNodeData bookmark_drag_data;
if (bookmark_drag_data.Read(os_exchange_data))
tab_contents_->GetBookmarkDragDelegate()->OnDragEnter(bookmark_drag_data);
}
@@ -155,7 +155,7 @@ DWORD WebDropTarget::OnDragOver(IDataObject* data_object,
if (tab_contents_->GetBookmarkDragDelegate()) {
OSExchangeData os_exchange_data(new OSExchangeDataProviderWin(data_object));
- BookmarkDragData bookmark_drag_data;
+ BookmarkNodeData bookmark_drag_data;
if (bookmark_drag_data.Read(os_exchange_data))
tab_contents_->GetBookmarkDragDelegate()->OnDragOver(bookmark_drag_data);
}
@@ -176,7 +176,7 @@ void WebDropTarget::OnDragLeave(IDataObject* data_object) {
if (tab_contents_->GetBookmarkDragDelegate()) {
OSExchangeData os_exchange_data(new OSExchangeDataProviderWin(data_object));
- BookmarkDragData bookmark_drag_data;
+ BookmarkNodeData bookmark_drag_data;
if (bookmark_drag_data.Read(os_exchange_data))
tab_contents_->GetBookmarkDragDelegate()->OnDragLeave(bookmark_drag_data);
}
@@ -204,7 +204,7 @@ DWORD WebDropTarget::OnDrop(IDataObject* data_object,
if (tab_contents_->GetBookmarkDragDelegate()) {
OSExchangeData os_exchange_data(new OSExchangeDataProviderWin(data_object));
- BookmarkDragData bookmark_drag_data;
+ BookmarkNodeData bookmark_drag_data;
if (bookmark_drag_data.Read(os_exchange_data))
tab_contents_->GetBookmarkDragDelegate()->OnDrop(bookmark_drag_data);
}
diff --git a/chrome/browser/tab_contents/web_navigation_observer.h b/chrome/browser/tab_contents/web_navigation_observer.h
new file mode 100644
index 0000000..40981b9
--- /dev/null
+++ b/chrome/browser/tab_contents/web_navigation_observer.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2010 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.
+
+#ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_NAVIGATION_OBSERVER_H_
+#define CHROME_BROWSER_TAB_CONTENTS_WEB_NAVIGATION_OBSERVER_H_
+
+#include "chrome/browser/tab_contents/navigation_controller.h"
+
+struct ViewHostMsg_FrameNavigate_Params;
+
+// An observer API implemented by classes which are interested in various page
+// load events from TabContents.
+
+// TODO(pink): Is it worth having a bitfield where certain clients can only
+// register for certain events? Is the extra function call worth the added pain
+// on the caller to build the bitfield?
+
+class WebNavigationObserver {
+ public:
+ // For removing PasswordManager deps...
+
+ virtual void NavigateToPendingEntry() { }
+
+ virtual void DidNavigateMainFramePostCommit(
+ const NavigationController::LoadCommittedDetails& details,
+ const ViewHostMsg_FrameNavigate_Params& params) { }
+ virtual void DidNavigateAnyFramePostCommit(
+ const NavigationController::LoadCommittedDetails& details,
+ const ViewHostMsg_FrameNavigate_Params& params) { }
+
+ virtual void DidStartLoading() { }
+ virtual void DidStopLoading() { }
+
+ // TODO(beng): These should move from here once PasswordManager is able to
+ // establish its own private communication protocol to the
+ // renderer.
+ virtual void PasswordFormsFound(
+ const std::vector<webkit_glue::PasswordForm>& forms) { }
+ virtual void PasswordFormsVisible(
+ const std::vector<webkit_glue::PasswordForm>& visible_forms) { }
+
+#if 0
+ // For unifying with delegate...
+
+ // Notifies the delegate that this contents is starting or is done loading
+ // some resource. The delegate should use this notification to represent
+ // loading feedback. See TabContents::is_loading()
+ virtual void LoadingStateChanged(TabContents* contents) { }
+ // Called to inform the delegate that the tab content's navigation state
+ // changed. The |changed_flags| indicates the parts of the navigation state
+ // that have been updated, and is any combination of the
+ // |TabContents::InvalidateTypes| bits.
+ virtual void NavigationStateChanged(const TabContents* source,
+ unsigned changed_flags) { }
+#endif
+};
+
+#endif // CHROME_BROWSER_TAB_CONTENTS_WEB_NAVIGATION_OBSERVER_H_