diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-13 23:35:51 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-13 23:35:51 +0000 |
commit | c8951c336442bcc74cb285bcc84f3087a1c94c90 (patch) | |
tree | 4aa74240e0e4ee5b2e56ea0402e8ba4c9fcf00af | |
parent | 42f904b277f400def0fd5baf2dbd9c2080f9da99 (diff) | |
download | chromium_src-c8951c336442bcc74cb285bcc84f3087a1c94c90.zip chromium_src-c8951c336442bcc74cb285bcc84f3087a1c94c90.tar.gz chromium_src-c8951c336442bcc74cb285bcc84f3087a1c94c90.tar.bz2 |
Remove the DOMUIHost. It is not used by any code.
This also does a minor fix for forward-declares of RenderViewHostFactory.
Review URL: http://codereview.chromium.org/66046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13637 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.vcproj | 8 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui.h | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui_host.cc | 79 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui_host.h | 77 | ||||
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_manager.h | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.h | 8 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents_view_win.cc | 1 | ||||
-rw-r--r-- | chrome/browser/views/dom_view.cc | 2 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 |
11 files changed, 4 insertions, 188 deletions
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 545c435..0ffd40e 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -1522,14 +1522,6 @@ > </File> <File - RelativePath=".\dom_ui\dom_ui_host.cc" - > - </File> - <File - RelativePath=".\dom_ui\dom_ui_host.h" - > - </File> - <File RelativePath=".\dom_ui\dom_ui_thumbnail_source.cc" > </File> diff --git a/chrome/browser/dom_ui/dom_ui.h b/chrome/browser/dom_ui/dom_ui.h index 4be503c..68db631 100644 --- a/chrome/browser/dom_ui/dom_ui.h +++ b/chrome/browser/dom_ui/dom_ui.h @@ -122,8 +122,8 @@ class DOMUI { DISALLOW_COPY_AND_ASSIGN(DOMUI); }; -// Messages sent from the DOM are forwarded via the DOMUIContents to handler -// classes. These objects are owned by DOMUIHost and destroyed when the +// Messages sent from the DOM are forwarded via the DOMUI to handler +// classes. These objects are owned by DOMUI and destroyed when the // host is destroyed. class DOMMessageHandler { public: diff --git a/chrome/browser/dom_ui/dom_ui_host.cc b/chrome/browser/dom_ui/dom_ui_host.cc deleted file mode 100644 index ffeda1b..0000000 --- a/chrome/browser/dom_ui/dom_ui_host.cc +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/dom_ui/dom_ui_host.h" - -#include "base/json_reader.h" -#include "base/json_writer.h" -#include "base/values.h" -#include "chrome/browser/browser.h" -#include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/tab_contents/navigation_entry.h" - -DOMUIHost::DOMUIHost(Profile* profile, - SiteInstance* instance, - RenderViewHostFactory* render_view_factory) - : WebContents(profile, - instance, - MSG_ROUTING_NONE, - NULL) { - // Implementors of this class will have a specific tab contents type. - set_type(TAB_CONTENTS_UNKNOWN_TYPE); -} - -DOMUIHost::~DOMUIHost() { - STLDeleteContainerPairSecondPointers(message_callbacks_.begin(), - message_callbacks_.end()); - STLDeleteContainerPointers(handlers_.begin(), handlers_.end()); -} - -bool DOMUIHost::CreateRenderViewForRenderManager( - RenderViewHost* render_view_host) { - // Be sure to enable DOM UI bindings on the RenderViewHost before - // CreateRenderView is called. Since a cross-site transition may be - // involved, this may or may not be the same RenderViewHost that we had when - // we were created. - render_view_host->AllowDOMUIBindings(); - return WebContents::CreateRenderViewForRenderManager(render_view_host); -} - -void DOMUIHost::AddMessageHandler(DOMMessageHandler* handler) { - handlers_.push_back(handler); -} - -void DOMUIHost::RegisterMessageCallback(const std::string& name, - MessageCallback* callback) { - message_callbacks_.insert(std::make_pair(name, callback)); -} - -void DOMUIHost::ProcessDOMUIMessage(const std::string& message, - const std::string& content) { - // Look up the callback for this message. - MessageCallbackMap::const_iterator callback(message_callbacks_.find(message)); - if (callback == message_callbacks_.end()) - return; - - // Convert the content JSON into a Value. - scoped_ptr<Value> value; - if (!content.empty()) { - value.reset(JSONReader::Read(content, false)); - if (!value.get()) { - // The page sent us something that we didn't understand. - // This probably indicates a programming error. - NOTREACHED(); - return; - } - } - - // Forward this message and content on. - callback->second->Run(value.get()); -} - -WebPreferences DOMUIHost::GetWebkitPrefs() { - // Get the users preferences then force image loading to always be on. - WebPreferences web_prefs = WebContents::GetWebkitPrefs(); - web_prefs.loads_images_automatically = true; - - return web_prefs; -} diff --git a/chrome/browser/dom_ui/dom_ui_host.h b/chrome/browser/dom_ui/dom_ui_host.h deleted file mode 100644 index 845aaf1..0000000 --- a/chrome/browser/dom_ui/dom_ui_host.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// THIS FILE IS DEPRECATED, USE DOM_UI INSTEAD. - -#ifndef CHROME_BROWSER_DOM_UI_DOM_UI_HOST_H__ -#define CHROME_BROWSER_DOM_UI_DOM_UI_HOST_H__ - -#include "chrome/browser/dom_ui/dom_ui.h" -#include "chrome/browser/tab_contents/web_contents.h" -#include "webkit/glue/webpreferences.h" - -class DOMMessageDispatcher; -class RenderProcessHost; -class RenderViewHost; -class Value; - -// See the comments at the top of this file. -class DOMUIHost : public WebContents { - public: - DOMUIHost(Profile* profile, - SiteInstance* instance, - RenderViewHostFactory* render_view_factory); - - // Initializes the given renderer, after enabling DOM UI bindings on it. - virtual bool CreateRenderViewForRenderManager( - RenderViewHost* render_view_host); - - // Add type-specific javascript message handlers. - // TODO(timsteele): Any implementation of this method should really be done - // upon construction, but that won't work until the TabContents::controller() - // API is fixed to never return NULL, and likewise for TabContents::profile(). - // Only then could any Handlers we attach here access the profile upon - // construction, which is the most common case; currently they'll blow up. - virtual void AttachMessageHandlers() = 0; - - // Add |handler| to the list of handlers owned by this object. - // They will be destroyed when this page is hidden. - void AddMessageHandler(DOMMessageHandler* handler); - - // Register a callback for a specific message. - typedef Callback1<const Value*>::Type MessageCallback; - void RegisterMessageCallback(const std::string& message, - MessageCallback* callback); - - // Overrides from WebContents. - virtual void ProcessDOMUIMessage(const std::string& message, - const std::string& content); - virtual DOMUIHost* AsDOMUIHost() { return this; } - - // Override this method so we can ensure that javascript and image loading - // are always on even for DOMUIHost tabs. - virtual WebPreferences GetWebkitPrefs(); - - // We override updating history with a no-op so these pages - // are not saved to history. - virtual void UpdateHistoryForNavigation(const GURL& url, - const ViewHostMsg_FrameNavigate_Params& params) { } - - protected: - // Should delete via CloseContents. - virtual ~DOMUIHost(); - - private: - - // The DOMMessageHandlers we own. - std::vector<DOMMessageHandler*> handlers_; - - // A map of message name -> message handling callback. - typedef std::map<std::string, MessageCallback*> MessageCallbackMap; - MessageCallbackMap message_callbacks_; - - DISALLOW_EVIL_CONSTRUCTORS(DOMUIHost); -}; - -#endif // CHROME_BROWSER_DOM_UI_DOM_UI_HOST_H__ diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index 444c41d..3db44d7 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -10,7 +10,6 @@ #include "base/time.h" #include "chrome/browser/browser_about_handler.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/dom_ui/dom_ui_host.h" #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/repost_form_warning.h" @@ -1081,8 +1080,6 @@ void NavigationController::RegisterTabContents(TabContents* some_contents) { some_contents->set_controller(this); } } - if (some_contents->AsDOMUIHost()) - some_contents->AsDOMUIHost()->AttachMessageHandlers(); } // static diff --git a/chrome/browser/tab_contents/render_view_host_manager.h b/chrome/browser/tab_contents/render_view_host_manager.h index dcd2c48..09bd4ea 100644 --- a/chrome/browser/tab_contents/render_view_host_manager.h +++ b/chrome/browser/tab_contents/render_view_host_manager.h @@ -17,7 +17,6 @@ class NavigationController; class NavigationEntry; class Profile; class RenderViewHostDelegate; -class RenderViewHostFactory; class RenderWidgetHostView; class SiteInstance; @@ -221,9 +220,6 @@ class RenderViewHostManager : public NotificationObserver { // for the view type (like view source versus not). bool cross_navigation_pending_; - // Allows tests to create their own render view host types. - RenderViewHostFactory* render_view_factory_; - // Implemented by the owner of this class, this delegate is installed into all // the RenderViewHosts that we create. RenderViewHostDelegate* render_view_delegate_; diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index a8b8883..e013bdb 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -34,7 +34,6 @@ class WindowDelegate; class BlockedPopupContainer; class DOMUIContents; -class DOMUIHost; class DownloadItem; class DownloadShelf; class InfoBarView; @@ -137,9 +136,6 @@ class TabContents : public PageNavigator, return const_cast<TabContents*>(this)->AsWebContents(); } - // Returns this object as a DOMUIHost if it is one, and NULL otherwise. - virtual DOMUIHost* AsDOMUIHost() { return NULL; } - // Returns this object as a DOMUIContents if it is one, and NULL otherwise. virtual DOMUIContents* AsDOMUIContents() { return NULL; } diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h index 0e62e8d..d02322e 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -69,9 +69,7 @@ class WebContents : public TabContents, public: // If instance is NULL, then creates a new process for this view. Otherwise // initialize with a process already created for a different WebContents. - // This will share the process between views in the same instance. If - // render_view_factory is NULL, this will create RenderViewHost objects - // directly. + // This will share the process between views in the same instance. WebContents(Profile* profile, SiteInstance* instance, int routing_id, @@ -470,10 +468,6 @@ class WebContents : public TabContents, // // If you are attaching to an already-existing RenderView, you should call // InitWithExistingID. - // - // TODO(brettw) clean this up! This logic seems out of place. This is called - // by the RenderViewHostManager, but also overridden by the DOMUIHost. Any - // logic that has to be here should have a more clear name. virtual bool CreateRenderViewForRenderManager( RenderViewHost* render_view_host); diff --git a/chrome/browser/tab_contents/web_contents_view_win.cc b/chrome/browser/tab_contents/web_contents_view_win.cc index 3fd45b9..8b949c9 100644 --- a/chrome/browser/tab_contents/web_contents_view_win.cc +++ b/chrome/browser/tab_contents/web_contents_view_win.cc @@ -9,7 +9,6 @@ #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. #include "chrome/browser/browser_process.h" -#include "chrome/browser/dom_ui/dom_ui_host.h" #include "chrome/browser/download/download_request_manager.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/views/dom_view.cc index c915e39..3e1c777 100644 --- a/chrome/browser/views/dom_view.cc +++ b/chrome/browser/views/dom_view.cc @@ -4,7 +4,7 @@ #include "chrome/browser/views/dom_view.h" -#include "chrome/browser/dom_ui/dom_ui_host.h" +#include "chrome/browser/tab_contents/web_contents.h" DOMView::DOMView() : initialized_(false), web_contents_(NULL) { SetFocusable(true); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index ba86821..89f0d93 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -616,8 +616,6 @@ 'browser/dom_ui/dom_ui_factory.h', 'browser/dom_ui/dom_ui_favicon_source.cc', 'browser/dom_ui/dom_ui_favicon_source.h', - 'browser/dom_ui/dom_ui_host.cc', - 'browser/dom_ui/dom_ui_host.h', 'browser/dom_ui/dom_ui_thumbnail_source.cc', 'browser/dom_ui/dom_ui_thumbnail_source.h', 'browser/dom_ui/downloads_ui.cc', |