summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-13 23:35:51 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-13 23:35:51 +0000
commitc8951c336442bcc74cb285bcc84f3087a1c94c90 (patch)
tree4aa74240e0e4ee5b2e56ea0402e8ba4c9fcf00af /chrome/browser/dom_ui
parent42f904b277f400def0fd5baf2dbd9c2080f9da99 (diff)
downloadchromium_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
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/dom_ui.h4
-rw-r--r--chrome/browser/dom_ui/dom_ui_host.cc79
-rw-r--r--chrome/browser/dom_ui/dom_ui_host.h77
3 files changed, 2 insertions, 158 deletions
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__