summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-26 19:37:43 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-26 19:37:43 +0000
commit540f91b592b8a500442bccdebffbd34a4d8bc1bd (patch)
tree3affcb4be40db37b7b1d67fc82b737ca72f099f8
parentb8bb00fdd7637ea8d2084e72c079921521d360a3 (diff)
downloadchromium_src-540f91b592b8a500442bccdebffbd34a4d8bc1bd.zip
chromium_src-540f91b592b8a500442bccdebffbd34a4d8bc1bd.tar.gz
chromium_src-540f91b592b8a500442bccdebffbd34a4d8bc1bd.tar.bz2
Minor tweaks to get chrome-ui://extensions working on the Mac.
Review URL: http://codereview.chromium.org/42627 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12586 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/dom_ui_factory.cc199
-rw-r--r--chrome/browser/extensions/extensions_service.cc12
-rw-r--r--chrome/chrome.gyp2
-rw-r--r--chrome/renderer/render_view.cc6
4 files changed, 109 insertions, 110 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc
index 228aa8c..7a69c0b 100644
--- a/chrome/browser/dom_ui/dom_ui_factory.cc
+++ b/chrome/browser/dom_ui/dom_ui_factory.cc
@@ -1,102 +1,97 @@
-// Copyright (c) 2009 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_factory.h"
-
-#include "chrome/browser/dom_ui/downloads_ui.h"
-#include "chrome/browser/dom_ui/debugger_ui.h"
-#include "chrome/browser/dom_ui/devtools_ui.h"
-#include "chrome/browser/dom_ui/history_ui.h"
-#include "chrome/browser/dom_ui/new_tab_ui.h"
-#include "chrome/browser/extensions/extensions_ui.h"
-#include "chrome/common/url_constants.h"
-#include "googleurl/src/gurl.h"
-
-// Backend for both querying for and creating new DOMUI objects. If you're just
-// querying whether there's a DOM UI for the given URL, pass NULL for both the
-// web contents and the new_ui. The return value will indiacate whether a DOM UI
-// exists for the given URL.
-//
-// If you want to create a DOM UI, pass non-NULL pointers for both web_contents
-// and new_ui. The *new_ui pointer will be filled with the created UI if it
-// succeeds (indicated by a return value of true). The caller owns the *new_ui
-// pointer.
-static bool CreateDOMUI(const GURL& url, WebContents* web_contents,
- DOMUI** new_ui) {
- // This will get called a lot to check all URLs, so do a quick check of the
- // scheme to filter out most URLs.
- if (!url.SchemeIs(chrome::kChromeInternalScheme) &&
- !url.SchemeIs(chrome::kChromeUIScheme))
- return false;
-
- // Special case the new tab page. In older versions of Chrome, the new tab
- // page was hosted at chrome-internal:<blah>. This might be in people's saved
- // sessions or bookmarks, so we say any URL with that scheme triggers the new
- // tab page.
- if (url.host() == chrome::kChromeUINewTabHost ||
- url.SchemeIs(chrome::kChromeInternalScheme)) {
- if (new_ui)
- *new_ui = new NewTabUI(web_contents);
- return true;
- }
-
- // We must compare hosts only since some of the DOM UIs append extra stuff
- // after the host name.
- if (url.host() == chrome::kChromeUIHistoryHost) {
- if (new_ui)
- *new_ui = new HistoryUI(web_contents);
- return true;
- }
-
- if (url.host() == chrome::kChromeUIDownloadsHost) {
- if (new_ui)
- *new_ui = new DownloadsUI(web_contents);
- return true;
- }
-
-#if defined(OS_WIN)
-
- // TODO(port): it should be possible to include these now.
- if (url.host() == chrome::kChromeUIExtensionsHost) {
- if (new_ui)
- *new_ui = new ExtensionsUI(web_contents);
- return true;
- }
-
- if (url.host() == chrome::kChromeUIInspectorHost) {
- if (new_ui)
- *new_ui = new DebuggerUI(web_contents);
- return true;
- }
-
- if (url.host() == chrome::kChromeUIDevToolsHost) {
- if (new_ui)
- *new_ui = new DevToolsUI(web_contents);
- return true;
- }
-
-#endif
-
- return false;
-}
-
-// static
-bool DOMUIFactory::HasDOMUIScheme(const GURL& url) {
- return url.SchemeIs(chrome::kChromeInternalScheme) ||
- url.SchemeIs(chrome::kChromeUIScheme);
-}
-
-// static
-bool DOMUIFactory::UseDOMUIForURL(const GURL& url) {
- return CreateDOMUI(url, NULL, NULL);
-}
-
-// static
-DOMUI* DOMUIFactory::CreateDOMUIForURL(WebContents* web_contents,
- const GURL& url) {
- DOMUI* dom_ui;
- if (!CreateDOMUI(url, web_contents, &dom_ui))
- return NULL;
- return dom_ui;
-}
+// Copyright (c) 2009 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_factory.h"
+
+#include "chrome/browser/dom_ui/downloads_ui.h"
+#include "chrome/browser/dom_ui/debugger_ui.h"
+#include "chrome/browser/dom_ui/devtools_ui.h"
+#include "chrome/browser/dom_ui/history_ui.h"
+#include "chrome/browser/dom_ui/new_tab_ui.h"
+#include "chrome/browser/extensions/extensions_ui.h"
+#include "chrome/common/url_constants.h"
+#include "googleurl/src/gurl.h"
+
+// Backend for both querying for and creating new DOMUI objects. If you're just
+// querying whether there's a DOM UI for the given URL, pass NULL for both the
+// web contents and the new_ui. The return value will indiacate whether a DOM UI
+// exists for the given URL.
+//
+// If you want to create a DOM UI, pass non-NULL pointers for both web_contents
+// and new_ui. The *new_ui pointer will be filled with the created UI if it
+// succeeds (indicated by a return value of true). The caller owns the *new_ui
+// pointer.
+static bool CreateDOMUI(const GURL& url, WebContents* web_contents,
+ DOMUI** new_ui) {
+ // This will get called a lot to check all URLs, so do a quick check of the
+ // scheme to filter out most URLs.
+ if (!url.SchemeIs(chrome::kChromeInternalScheme) &&
+ !url.SchemeIs(chrome::kChromeUIScheme))
+ return false;
+
+ // Special case the new tab page. In older versions of Chrome, the new tab
+ // page was hosted at chrome-internal:<blah>. This might be in people's saved
+ // sessions or bookmarks, so we say any URL with that scheme triggers the new
+ // tab page.
+ if (url.host() == chrome::kChromeUINewTabHost ||
+ url.SchemeIs(chrome::kChromeInternalScheme)) {
+ if (new_ui)
+ *new_ui = new NewTabUI(web_contents);
+ return true;
+ }
+
+ // We must compare hosts only since some of the DOM UIs append extra stuff
+ // after the host name.
+ if (url.host() == chrome::kChromeUIHistoryHost) {
+ if (new_ui)
+ *new_ui = new HistoryUI(web_contents);
+ return true;
+ }
+
+ if (url.host() == chrome::kChromeUIDownloadsHost) {
+ if (new_ui)
+ *new_ui = new DownloadsUI(web_contents);
+ return true;
+ }
+
+ if (url.host() == chrome::kChromeUIExtensionsHost) {
+ if (new_ui)
+ *new_ui = new ExtensionsUI(web_contents);
+ return true;
+ }
+
+ if (url.host() == chrome::kChromeUIInspectorHost) {
+ if (new_ui)
+ *new_ui = new DebuggerUI(web_contents);
+ return true;
+ }
+
+ if (url.host() == chrome::kChromeUIDevToolsHost) {
+ if (new_ui)
+ *new_ui = new DevToolsUI(web_contents);
+ return true;
+ }
+
+ return false;
+}
+
+// static
+bool DOMUIFactory::HasDOMUIScheme(const GURL& url) {
+ return url.SchemeIs(chrome::kChromeInternalScheme) ||
+ url.SchemeIs(chrome::kChromeUIScheme);
+}
+
+// static
+bool DOMUIFactory::UseDOMUIForURL(const GURL& url) {
+ return CreateDOMUI(url, NULL, NULL);
+}
+
+// static
+DOMUI* DOMUIFactory::CreateDOMUIForURL(WebContents* web_contents,
+ const GURL& url) {
+ DOMUI* dom_ui;
+ if (!CreateDOMUI(url, web_contents, &dom_ui))
+ return NULL;
+ return dom_ui;
+}
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 2c3451b..6b73b65 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -184,8 +184,15 @@ void ExtensionsServiceBackend::LoadExtensionsFromInstallDirectory(
frontend_ = frontend;
alert_on_error_ = false;
+#if defined(OS_WIN)
+ // On POSIX, AbsolutePath() calls realpath() which returns NULL if
+ // it does not exist. Instead we absolute-ify after creation in
+ // case that is needed.
+ // TODO(port): does this really need to happen before
+ // CreateDirectory() on Windows?
if (!file_util::AbsolutePath(&install_directory_))
NOTREACHED();
+#endif
scoped_ptr<ExtensionList> extensions(new ExtensionList);
@@ -197,6 +204,11 @@ void ExtensionsServiceBackend::LoadExtensionsFromInstallDirectory(
return;
}
+#if !defined(OS_WIN)
+ if (!file_util::AbsolutePath(&install_directory_))
+ NOTREACHED();
+#endif
+
LOG(INFO) << "Loading installed extensions...";
// Find all child directories in the install directory and load their
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index d58c608..67c96cf 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1248,8 +1248,6 @@
'browser/bookmarks/bookmark_context_menu.cc',
'browser/bookmarks/bookmark_drop_info.cc',
'browser/debugger/debugger_shell_stubs.cc',
- 'browser/dom_ui/devtools_ui.cc',
- 'browser/dom_ui/devtools_ui.h',
],
'sources': [
# Build the necessary GTM sources
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 4c55bb5..1109750 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2848,15 +2848,9 @@ std::string RenderView::GetAltHTMLForTemplate(
NOTREACHED() << "unable to load template. ID: " << template_resource_id;
return "";
}
-#if defined(OS_WIN)
// "t" is the id of the templates root node.
return jstemplate_builder::GetTemplateHtml(
template_html, &error_strings, "t");
-#else
- // TODO(port)
- NOTIMPLEMENTED();
- return std::string();
-#endif // OS_WIN
}
MessageLoop* RenderView::GetMessageLoopForIO() {