Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(886)

Unified Diff: chrome/renderer/render_view.h

Issue 6151011: Introduce RenderView::Observer interface so that RenderView doesn't have to k... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/password_autocomplete_manager_unittest.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.h
===================================================================
--- chrome/renderer/render_view.h (revision 71253)
+++ chrome/renderer/render_view.h (working copy)
@@ -17,6 +17,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/linked_ptr.h"
+#include "base/observer_list.h"
#include "base/timer.h"
#include "base/weak_ptr.h"
#include "build/build_config.h"
@@ -35,7 +36,6 @@
#include "chrome/renderer/renderer_webcookiejar_impl.h"
#include "chrome/renderer/searchbox.h"
#include "chrome/renderer/translate_helper.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebAutoFillClient.h"
#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h"
@@ -55,7 +55,6 @@
#endif
class AudioMessageFilter;
-class AutoFillHelper;
class BlockedPlugin;
class CustomMenuListener;
class DictionaryValue;
@@ -73,10 +72,9 @@
class LoadProgressTracker;
class NavigationState;
class NotificationProvider;
-class PageClickTracker;
-class PasswordAutocompleteManager;
class PepperDeviceTest;
class PrintWebViewHelper;
+class RenderViewObserver;
class RenderViewVisitor;
class SkBitmap;
class SpeechInputDispatcher;
@@ -174,7 +172,6 @@
// communication interface with an embedding application process
//
class RenderView : public RenderWidget,
- public WebKit::WebAutoFillClient,
public WebKit::WebViewClient,
public WebKit::WebFrameClient,
public WebKit::WebPageSerializerClient,
@@ -239,10 +236,6 @@
send_content_state_immediately_ = value;
}
- PageClickTracker* page_click_tracker() const {
- return page_click_tracker_.get();
- }
-
// May be NULL if client-side phishing detection is disabled.
safe_browsing::PhishingClassifierDelegate*
phishing_classifier_delegate() const {
@@ -261,6 +254,10 @@
return search_box_;
}
+ // Functions to add and remove observers for this object.
+ void AddObserver(RenderViewObserver* observer);
+ void RemoveObserver(RenderViewObserver* observer);
+
// Called from JavaScript window.external.AddSearchProvider() to add a
// keyword for a provider described in the given OpenSearch document.
void AddSearchProvider(const std::string& url,
@@ -397,30 +394,6 @@
virtual bool OnMessageReceived(const IPC::Message& msg);
- // WebKit::WebAutoFillClient implementation ----------------------------------
- virtual void didAcceptAutoFillSuggestion(const WebKit::WebNode& node,
- const WebKit::WebString& value,
- const WebKit::WebString& label,
- int unique_id,
- unsigned index);
- virtual void didSelectAutoFillSuggestion(const WebKit::WebNode& node,
- const WebKit::WebString& value,
- const WebKit::WebString& label,
- int unique_id);
- virtual void didClearAutoFillSelection(const WebKit::WebNode& node);
- virtual void didAcceptAutocompleteSuggestion(
- const WebKit::WebInputElement& element);
- virtual void removeAutocompleteSuggestion(const WebKit::WebString& name,
- const WebKit::WebString& value);
- // TODO(jam): remove this function after WebKit roll
- virtual void removeAutofillSuggestions(const WebKit::WebString& name,
- const WebKit::WebString& value);
- virtual void textFieldDidEndEditing(const WebKit::WebInputElement& element);
- virtual void textFieldDidChange(const WebKit::WebInputElement& element);
- virtual void textFieldDidReceiveKeyDown(
- const WebKit::WebInputElement& element,
- const WebKit::WebKeyboardEvent& event);
-
// WebKit::WebWidgetClient implementation ------------------------------------
// Most methods are handled by RenderWidget.
@@ -753,22 +726,18 @@
};
RenderView(RenderThreadBase* render_thread,
- const WebPreferences& webkit_preferences,
- int64 session_storage_namespace_id);
+ gfx::NativeViewId parent_hwnd,
+ int32 opener_id,
+ const RendererPreferences& renderer_prefs,
+ const WebPreferences& webkit_prefs,
+ SharedRenderViewCounter* counter,
+ int32 routing_id,
+ int64 session_storage_namespace_id,
+ const string16& frame_name);
// Do not delete directly. This class is reference counted.
virtual ~RenderView();
- // Initializes this view with the given parent and ID. The |routing_id| can be
- // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case,
- // CompleteInit must be called later with the true ID.
- void Init(gfx::NativeViewId parent,
- int32 opener_id,
- const RendererPreferences& renderer_prefs,
- SharedRenderViewCounter* counter,
- int32 routing_id,
- const string16& frame_name);
-
void UpdateURL(WebKit::WebFrame* frame);
void UpdateTitle(WebKit::WebFrame* frame, const string16& title);
void UpdateSessionHistory(WebKit::WebFrame* frame);
@@ -826,10 +795,6 @@
void AddGURLSearchProvider(const GURL& osd_url,
const ViewHostMsg_PageHasOSDD_Type& provider_type);
- // Called in a posted task by textFieldDidChange() to work-around a WebKit bug
- // http://bugs.webkit.org/show_bug.cgi?id=16976
- void TextFieldDidChangeImpl(const WebKit::WebInputElement& element);
-
// Send queued accessibility notifications from the renderer to the browser.
void SendPendingAccessibilityNotifications();
@@ -849,18 +814,6 @@
void OnAsyncFileOpened(base::PlatformFileError error_code,
IPC::PlatformFileForTransit file_for_transit,
int message_id);
- void OnAutocompleteSuggestionsReturned(
- int query_id,
- const std::vector<string16>& suggestions,
- int default_suggestions_index);
- void OnAutoFillFormDataFilled(int query_id,
- const webkit_glue::FormData& form);
- void OnAutoFillSuggestionsReturned(
- int query_id,
- const std::vector<string16>& values,
- const std::vector<string16>& labels,
- const std::vector<string16>& icons,
- const std::vector<int>& unique_ids);
void OnCancelDownload(int32 download_id);
void OnClearFocusedNode();
void OnClosePage(const ViewMsg_ClosePage_Params& params);
@@ -939,8 +892,6 @@
void OnMoveOrResizeStarted();
void OnNavigate(const ViewMsg_Navigate_Params& params);
void OnNotifyRendererViewType(ViewType::Type view_type);
- void OnFillPasswordForm(
- const webkit_glue::PasswordFormFillData& form_data);
void OnPaste();
#if defined(OS_MACOSX)
void OnPluginImeCompositionConfirmed(const string16& text, int plugin_id);
@@ -1376,46 +1327,42 @@
// Helper objects ------------------------------------------------------------
ScopedRunnableMethodFactory<RenderView> page_info_method_factory_;
- ScopedRunnableMethodFactory<RenderView> autofill_method_factory_;
ScopedRunnableMethodFactory<RenderView> accessibility_method_factory_;
// Responsible for translating the page contents to other languages.
TranslateHelper translate_helper_;
- // Responsible for automatically filling login and password textfields.
- scoped_ptr<PasswordAutocompleteManager> password_autocomplete_manager_;
-
- // Responsible for filling forms (AutoFill) and single text entries
- // (Autocomplete).
- scoped_ptr<AutoFillHelper> autofill_helper_;
-
- // Tracks when text input controls get clicked.
- // IMPORTANT: this should be declared after autofill_helper_ and
- // password_autocomplete_manager_ so the tracker is deleted first (so we won't
- // run the risk of notifying deleted objects).
- scoped_ptr<PageClickTracker> page_click_tracker_;
-
RendererWebCookieJarImpl cookie_jar_;
+ // The next group of objects all implement RenderViewObserver, so are deleted
+ // along with the RenderView automatically. This is why we just store weak
+ // references.
+
// Provides access to this renderer from the remote Inspector UI.
- scoped_ptr<DevToolsAgent> devtools_agent_;
+ DevToolsAgent* devtools_agent_;
// DevToolsClient for renderer hosting developer tools UI. It's NULL for other
// render views.
- scoped_ptr<DevToolsClient> devtools_client_;
+ DevToolsClient* devtools_client_;
// Holds a reference to the service which provides desktop notifications.
- scoped_ptr<NotificationProvider> notification_provider_;
+ NotificationProvider* notification_provider_;
+ // The geolocation dispatcher attached to this view, lazily initialized.
+ GeolocationDispatcher* geolocation_dispatcher_;
+
+ // The speech dispatcher attached to this view, lazily initialized.
+ SpeechInputDispatcher* speech_input_dispatcher_;
+
+ // Device orientation dispatcher attached to this view; lazily initialized.
+ DeviceOrientationDispatcher* device_orientation_dispatcher_;
+
// PrintWebViewHelper handles printing. Note that this object is constructed
// when printing for the first time but only destroyed with the RenderView.
scoped_ptr<PrintWebViewHelper> print_helper_;
scoped_refptr<AudioMessageFilter> audio_message_filter_;
- // The geolocation dispatcher attached to this view, lazily initialized.
- scoped_ptr<GeolocationDispatcher> geolocation_dispatcher_;
-
// Handles accessibility requests into the renderer side, as well as
// maintains the cache and other features of the accessibility tree.
scoped_ptr<WebKit::WebAccessibilityCache> accessibility_;
@@ -1428,12 +1375,6 @@
// Set if we are waiting for a accessibility notification ack.
bool accessibility_ack_pending_;
- // The speech dispatcher attached to this view, lazily initialized.
- scoped_ptr<SpeechInputDispatcher> speech_input_dispatcher_;
-
- // Device orientation dispatcher attached to this view; lazily initialized.
- scoped_ptr<DeviceOrientationDispatcher> device_orientation_dispatcher_;
-
// Responsible for sending page load related histograms.
PageLoadHistograms page_load_histograms_;
@@ -1519,11 +1460,17 @@
// Reports load progress to the browser.
scoped_ptr<LoadProgressTracker> load_progress_tracker_;
+ // All the registered observers. We expect this list to be small, so vector
+ // is fine.
+ ObserverList<RenderViewObserver> observers_;
+
// ---------------------------------------------------------------------------
// ADDING NEW DATA? Please see if it fits appropriately in one of the above
// sections rather than throwing it randomly at the end. If you're adding a
// bunch of stuff, you should probably create a helper class and put your
- // data and methods on that to avoid bloating RenderView more.
+ // data and methods on that to avoid bloating RenderView more. You can use
+ // the Observer interface to filter IPC messages and receive frame change
+ // notifications.
// ---------------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(RenderView);
« no previous file with comments | « chrome/renderer/password_autocomplete_manager_unittest.cc ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698