diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 03:05:11 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 03:05:11 +0000 |
commit | 4acc19a6f31abef9608546d10f107240603ca57e (patch) | |
tree | 632c914c428e94c05c8b9cb52cb183e62ae13e56 /chrome | |
parent | 15936cdb983239ba2347e624af19e7305e416c7b (diff) | |
download | chromium_src-4acc19a6f31abef9608546d10f107240603ca57e.zip chromium_src-4acc19a6f31abef9608546d10f107240603ca57e.tar.gz chromium_src-4acc19a6f31abef9608546d10f107240603ca57e.tar.bz2 |
Move HTML dialogs out of their own tab contents type. Moved functions to new
file html_dialog_ui.*
Move WebContents view creation into the constructor, which makes a bunch of
extra calls to CreateView unnecessary.
Remove unused CallJavascriptFunction() functions in DOMUI.
Review URL: http://codereview.chromium.org/56065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
39 files changed, 252 insertions, 302 deletions
diff --git a/chrome/browser/back_forward_menu_model_unittest.cc b/chrome/browser/back_forward_menu_model_unittest.cc index 1e9cf09..0f3908a 100644 --- a/chrome/browser/back_forward_menu_model_unittest.cc +++ b/chrome/browser/back_forward_menu_model_unittest.cc @@ -95,7 +95,6 @@ class BackFwdMenuModelTest : public testing::Test { protected: TabContents* CreateTabContents() { TabContents* contents = new BackFwdMenuModelTestTabContents; - contents->CreateView(); contents->SetupController(profile_); return contents; } diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index f4f6d94..3a69158 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1908,7 +1908,7 @@ gfx::Rect Browser::GetRootWindowResizerRect() const { return window_->GetRootWindowResizerRect(); } -void Browser::ShowHtmlDialog(HtmlDialogContentsDelegate* delegate, +void Browser::ShowHtmlDialog(HtmlDialogUIDelegate* delegate, void* parent_window) { window_->ShowHTMLDialog(delegate, parent_window); } diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 24f3e05..48fceca 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -440,7 +440,7 @@ class Browser : public TabStripModelDelegate, bool proceed, bool* proceed_to_fire_unload); virtual gfx::Rect GetRootWindowResizerRect() const; - virtual void ShowHtmlDialog(HtmlDialogContentsDelegate* delegate, + virtual void ShowHtmlDialog(HtmlDialogUIDelegate* delegate, void* parent_window); virtual void SetFocusToLocationBar(); virtual void RenderWidgetShowing(); diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 63934d7..9292222 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -1566,11 +1566,11 @@ > </File> <File - RelativePath=".\dom_ui\html_dialog_contents.cc" + RelativePath=".\dom_ui\html_dialog_ui.cc" > </File> <File - RelativePath=".\dom_ui\html_dialog_contents.h" + RelativePath=".\dom_ui\html_dialog_ui.h" > </File> <File diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h index e91f945..b6b6e12 100644 --- a/chrome/browser/browser_window.h +++ b/chrome/browser/browser_window.h @@ -12,7 +12,7 @@ class BrowserList; class BrowserWindowTesting; class GURL; class LocationBar; -class HtmlDialogContentsDelegate; +class HtmlDialogUIDelegate; class Profile; class StatusBubble; class TabContents; @@ -169,7 +169,7 @@ class BrowserWindow { // Shows a dialog box with HTML content, e.g. for Gears. |parent_window| is // the window the dialog should be opened modal to and is a native window // handle. - virtual void ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, + virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, void* parent_window) = 0; // Construct a BrowserWindow implementation for the specified |browser|. diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc index 62b9411..373bee1 100644 --- a/chrome/browser/chrome_plugin_host.cc +++ b/chrome/browser/chrome_plugin_host.cc @@ -19,6 +19,7 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/chrome_plugin_browsing_context.h" #include "chrome/browser/chrome_thread.h" +#include "chrome/browser/dom_ui/html_dialog_ui.h" #include "chrome/browser/gears_integration.h" #include "chrome/browser/plugin_process_host.h" #include "chrome/browser/plugin_service.h" @@ -43,7 +44,7 @@ // TODO(port): Port these files. #if defined(OS_WIN) -#include "chrome/browser/dom_ui/html_dialog_contents.h" +#include "chrome/browser/dom_ui/html_dialog_ui.h" #else #include "chrome/common/temp_scaffolding_stubs.h" #endif @@ -282,7 +283,7 @@ PluginCommandHandler* PluginCommandHandler::instance_ = NULL; // This class acts as a helper to display the HTML dialog. It is created // on demand on the plugin thread, and proxies calls to and from the UI thread // to display the UI. -class ModelessHtmlDialogDelegate : public HtmlDialogContentsDelegate { +class ModelessHtmlDialogDelegate : public HtmlDialogUIDelegate { public: ModelessHtmlDialogDelegate(const GURL& url, int width, int height, @@ -311,7 +312,7 @@ class ModelessHtmlDialogDelegate : public HtmlDialogContentsDelegate { // The following public methods are called from the UI thread. - // HtmlDialogContentsDelegate implementation: + // HtmlDialogUIDelegate implementation: virtual bool IsDialogModal() const { return false; } virtual std::wstring GetDialogTitle() const { return L"Google Gears"; } virtual GURL GetDialogContentURL() const { return params_.url; } @@ -344,7 +345,7 @@ class ModelessHtmlDialogDelegate : public HtmlDialogContentsDelegate { } // The parameters needed to display a modal HTML dialog. - HtmlDialogContents::HtmlDialogParams params_; + HtmlDialogUI::HtmlDialogParams params_; // Message loops for sending messages between UI and IO threads. MessageLoop* main_message_loop_; diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h index 9e73c18..c13d779 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.h +++ b/chrome/browser/cocoa/browser_window_cocoa.h @@ -65,7 +65,7 @@ class BrowserWindowCocoa : public BrowserWindow { virtual void ShowPasswordManager(); virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); - virtual void ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, + virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, void* parent_window); protected: diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm index e3bc4fe..792c2b3 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/cocoa/browser_window_cocoa.mm @@ -194,7 +194,7 @@ void BrowserWindowCocoa::ShowNewProfileDialog() { NOTIMPLEMENTED(); } -void BrowserWindowCocoa::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, +void BrowserWindowCocoa::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, void* parent_window) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index 020083d..19ea1f4 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -98,7 +98,6 @@ void DebuggerView::OnInit() { // view hierarchy somewhere. Profile* profile = BrowserList::GetLastActive()->profile(); web_contents_ = new WebContents(profile, NULL, NULL, MSG_ROUTING_NONE, NULL); - web_contents_->CreateView(); web_contents_->SetupController(profile); web_contents_->set_delegate(this); diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc index 7a69c0b..75786d8 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.cc +++ b/chrome/browser/dom_ui/dom_ui_factory.cc @@ -8,6 +8,7 @@ #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/html_dialog_ui.h" #include "chrome/browser/dom_ui/new_tab_ui.h" #include "chrome/browser/extensions/extensions_ui.h" #include "chrome/common/url_constants.h" @@ -24,8 +25,15 @@ // 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. + // Currently, any gears: URL means an HTML dialog. + if (url.SchemeIs(chrome::kGearsScheme)) { + if (new_ui) + *new_ui = new HtmlDialogUI(web_contents); + return true; + } + + // This will get called a lot to check all URLs, so do a quick check of other + // schemes (gears was handled above) to filter out most URLs. if (!url.SchemeIs(chrome::kChromeInternalScheme) && !url.SchemeIs(chrome::kChromeUIScheme)) return false; diff --git a/chrome/browser/dom_ui/dom_ui_host.cc b/chrome/browser/dom_ui/dom_ui_host.cc index 20ebc9f..f68105e 100644 --- a/chrome/browser/dom_ui/dom_ui_host.cc +++ b/chrome/browser/dom_ui/dom_ui_host.cc @@ -49,28 +49,6 @@ void DOMUIHost::RegisterMessageCallback(const std::string& name, message_callbacks_.insert(std::make_pair(name, callback)); } - -void DOMUIHost::CallJavascriptFunction(const std::wstring& function_name, - const Value& arg) { - std::string json; - JSONWriter::Write(&arg, false, &json); - std::wstring javascript = function_name + L"(" + UTF8ToWide(json) + L");"; - - ExecuteJavascript(javascript); -} - -void DOMUIHost::CallJavascriptFunction( - const std::wstring& function_name, - const Value& arg1, const Value& arg2) { - std::string json; - JSONWriter::Write(&arg1, false, &json); - std::wstring javascript = function_name + L"(" + UTF8ToWide(json); - JSONWriter::Write(&arg2, false, &json); - javascript += L"," + UTF8ToWide(json) + L");"; - - ExecuteJavascript(javascript); -} - void DOMUIHost::ProcessDOMUIMessage(const std::string& message, const std::string& content) { // Look up the callback for this message. @@ -101,7 +79,3 @@ WebPreferences DOMUIHost::GetWebkitPrefs() { return web_prefs; } - -void DOMUIHost::ExecuteJavascript(const std::wstring& javascript) { - render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(), javascript); -} diff --git a/chrome/browser/dom_ui/dom_ui_host.h b/chrome/browser/dom_ui/dom_ui_host.h index b66fe9b..845aaf1 100644 --- a/chrome/browser/dom_ui/dom_ui_host.h +++ b/chrome/browser/dom_ui/dom_ui_host.h @@ -44,19 +44,6 @@ class DOMUIHost : public WebContents { void RegisterMessageCallback(const std::string& message, MessageCallback* callback); - - // Call a Javascript function by sending its name and arguments down to - // the renderer. This is asynchronous; there's no way to get the result - // of the call, and should be thought of more like sending a message to - // the page. - // There are two function variants for one-arg and two-arg calls. - void CallJavascriptFunction(const std::wstring& function_name, - const Value& arg); - void CallJavascriptFunction(const std::wstring& function_name, - const Value& arg1, - const Value& arg2); - - // Overrides from WebContents. virtual void ProcessDOMUIMessage(const std::string& message, const std::string& content); @@ -76,8 +63,6 @@ class DOMUIHost : public WebContents { virtual ~DOMUIHost(); private: - // Execute a string of raw Javascript on the page. - void ExecuteJavascript(const std::wstring& javascript); // The DOMMessageHandlers we own. std::vector<DOMMessageHandler*> handlers_; diff --git a/chrome/browser/dom_ui/html_dialog_contents.cc b/chrome/browser/dom_ui/html_dialog_contents.cc deleted file mode 100644 index 7944a6a..0000000 --- a/chrome/browser/dom_ui/html_dialog_contents.cc +++ /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. - -#include "chrome/browser/dom_ui/html_dialog_contents.h" - -#include "base/values.h" -#include "chrome/browser/renderer_host/render_view_host.h" - -const char kGearsScheme[] = "gears"; - -HtmlDialogContents::HtmlDialogContents(Profile* profile, - SiteInstance* instance, - RenderViewHostFactory* rvf) - : DOMUIHost(profile, instance, rvf), - delegate_(NULL) { - set_type(TAB_CONTENTS_HTML_DIALOG); -} - -HtmlDialogContents::~HtmlDialogContents() { -} - -void HtmlDialogContents::Init(HtmlDialogContentsDelegate* delegate) { - delegate_ = delegate; - - std::string dialog_args; - if (delegate_) - dialog_args = delegate_->GetDialogArgs(); - - DCHECK(render_view_host()); - render_view_host()->SetDOMUIProperty("dialogArguments", dialog_args); -} - -//////////////////////////////////////////////////////////////////////////////// -// DOMUIHost implementation: - -void HtmlDialogContents::AttachMessageHandlers() { - // Hook up the javascript function calls, also known as chrome.send("foo") - // calls in the HTML, to the actual C++ functions. - RegisterMessageCallback("DialogClose", - NewCallback(this, &HtmlDialogContents::OnDialogClosed)); -} - -// static -bool HtmlDialogContents::IsHtmlDialogUrl(const GURL& url) { - return url.SchemeIs(kGearsScheme); -} - -//////////////////////////////////////////////////////////////////////////////// -// Private: - -// Helper function to read the JSON string from the Value parameter. -std::string GetJsonResponse(const Value* content) { - if (!content || !content->IsType(Value::TYPE_LIST)) { - NOTREACHED(); - return ""; - } - const ListValue* args = static_cast<const ListValue*>(content); - if (args->GetSize() != 1) { - NOTREACHED(); - return ""; - } - - std::string result; - Value* value = NULL; - if (!args->Get(0, &value) || !value->GetAsString(&result)) { - NOTREACHED(); - return ""; - } - - return result; -} - -void HtmlDialogContents::OnDialogClosed(const Value* content) { - if (delegate_) - delegate_->OnDialogClosed(GetJsonResponse(content)); -} diff --git a/chrome/browser/dom_ui/html_dialog_contents.h b/chrome/browser/dom_ui/html_dialog_contents.h deleted file mode 100644 index cb0f215..0000000 --- a/chrome/browser/dom_ui/html_dialog_contents.h +++ /dev/null @@ -1,76 +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. - -#ifndef CHROME_BROWSER_DOM_UI_HTML_DIALOG_CONTENTS_H__ -#define CHROME_BROWSER_DOM_UI_HTML_DIALOG_CONTENTS_H__ - -#include "base/gfx/size.h" -#include "chrome/browser/dom_ui/dom_ui_host.h" - -// Implement this class to receive notifications. -class HtmlDialogContentsDelegate { - public: - // Returns true if the contents needs to be run in a modal dialog. - virtual bool IsDialogModal() const = 0; - // Returns the title of the dialog. - virtual std::wstring GetDialogTitle() const = 0; - // Get the HTML file path for the content to load in the dialog. - virtual GURL GetDialogContentURL() const = 0; - // Get the size of the dialog. - virtual void GetDialogSize(gfx::Size* size) const = 0; - // Gets the JSON string input to use when showing the dialog. - virtual std::string GetDialogArgs() const = 0; - // A callback to notify the delegate that the dialog closed. - virtual void OnDialogClosed(const std::string& json_retval) = 0; - - protected: - ~HtmlDialogContentsDelegate() {} -}; - -//////////////////////////////////////////////////////////////////////////////// -// -// HtmlDialogContents is a simple wrapper around DOMUIHost and is used to -// display file URL contents inside a modal HTML dialog. -// -//////////////////////////////////////////////////////////////////////////////// -class HtmlDialogContents : public DOMUIHost { - public: - struct HtmlDialogParams { - // The URL for the content that will be loaded in the dialog. - GURL url; - // Width of the dialog. - int width; - // Height of the dialog. - int height; - // The JSON input to pass to the dialog when showing it. - std::string json_input; - }; - - HtmlDialogContents(Profile* profile, - SiteInstance* instance, - RenderViewHostFactory* rvf); - virtual ~HtmlDialogContents(); - - // Initialize the HtmlDialogContents with the given delegate. Must be called - // after the RenderViewHost is created. - void Init(HtmlDialogContentsDelegate* d); - - // Overridden from DOMUIHost: - virtual void AttachMessageHandlers(); - - // Returns true of this URL should be handled by the HtmlDialogContents. - static bool IsHtmlDialogUrl(const GURL& url); - - private: - // JS message handlers: - void OnDialogClosed(const Value* content); - - // The delegate that knows how to display the dialog and receives the response - // back from the dialog. - HtmlDialogContentsDelegate* delegate_; - - DISALLOW_EVIL_CONSTRUCTORS(HtmlDialogContents); -}; - -#endif // CHROME_BROWSER_DOM_UI_HTML_DIALOG_CONTENTS_H__ diff --git a/chrome/browser/dom_ui/html_dialog_ui.cc b/chrome/browser/dom_ui/html_dialog_ui.cc new file mode 100644 index 0000000..ab86040d --- /dev/null +++ b/chrome/browser/dom_ui/html_dialog_ui.cc @@ -0,0 +1,70 @@ +// 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/html_dialog_ui.h" + +#include "base/singleton.h" +#include "base/values.h" +#include "chrome/browser/tab_contents/web_contents.h" +#include "chrome/browser/renderer_host/render_view_host.h" + +HtmlDialogUI::HtmlDialogUI(WebContents* web_contents) : DOMUI(web_contents) { +} + +HtmlDialogUI::~HtmlDialogUI() { + // Make sure we can't get any more callbacks. + GetPropertyAccessor().DeleteProperty(web_contents()->property_bag()); +} + +// static +PropertyAccessor<HtmlDialogUIDelegate*>& HtmlDialogUI::GetPropertyAccessor() { + return *Singleton< PropertyAccessor<HtmlDialogUIDelegate*> >::get(); +} + +//////////////////////////////////////////////////////////////////////////////// +// Private: + +// Helper function to read the JSON string from the Value parameter. +static std::string GetJsonResponse(const Value* content) { + if (!content || !content->IsType(Value::TYPE_LIST)) { + NOTREACHED(); + return std::string(); + } + const ListValue* args = static_cast<const ListValue*>(content); + if (args->GetSize() != 1) { + NOTREACHED(); + return std::string(); + } + + std::string result; + Value* value = NULL; + if (!args->Get(0, &value) || !value->GetAsString(&result)) { + NOTREACHED(); + return std::string(); + } + + return result; +} + +void HtmlDialogUI::RenderViewCreated(RenderViewHost* render_view_host) { + // Hook up the javascript function calls, also known as chrome.send("foo") + // calls in the HTML, to the actual C++ functions. + RegisterMessageCallback("DialogClose", + NewCallback(this, &HtmlDialogUI::OnDialogClosed)); + + // Pass the arguments to the renderer supplied by the delegate. + std::string dialog_args; + HtmlDialogUIDelegate** delegate = GetPropertyAccessor().GetProperty( + web_contents()->property_bag()); + if (delegate) + dialog_args = (*delegate)->GetDialogArgs(); + render_view_host->SetDOMUIProperty("dialogArguments", dialog_args); +} + +void HtmlDialogUI::OnDialogClosed(const Value* content) { + HtmlDialogUIDelegate** delegate = GetPropertyAccessor().GetProperty( + web_contents()->property_bag()); + if (delegate) + (*delegate)->OnDialogClosed(GetJsonResponse(content)); +} diff --git a/chrome/browser/dom_ui/html_dialog_ui.h b/chrome/browser/dom_ui/html_dialog_ui.h new file mode 100644 index 0000000..070315f --- /dev/null +++ b/chrome/browser/dom_ui/html_dialog_ui.h @@ -0,0 +1,79 @@ +// 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. + +#ifndef CHROME_BROWSER_DOM_UI_HTML_DIALOG_UI_H_ +#define CHROME_BROWSER_DOM_UI_HTML_DIALOG_UI_H_ + +#include "base/gfx/size.h" +#include "chrome/browser/dom_ui/dom_ui.h" +#include "chrome/common/property_bag.h" +#include "googleurl/src/gurl.h" + +// Implement this class to receive notifications. +class HtmlDialogUIDelegate { + public: + // Returns true if the contents needs to be run in a modal dialog. + virtual bool IsDialogModal() const = 0; + + // Returns the title of the dialog. + virtual std::wstring GetDialogTitle() const = 0; + + // Get the HTML file path for the content to load in the dialog. + virtual GURL GetDialogContentURL() const = 0; + + // Get the size of the dialog. + virtual void GetDialogSize(gfx::Size* size) const = 0; + + // Gets the JSON string input to use when showing the dialog. + virtual std::string GetDialogArgs() const = 0; + + // A callback to notify the delegate that the dialog closed. + virtual void OnDialogClosed(const std::string& json_retval) = 0; + + protected: + ~HtmlDialogUIDelegate() {} +}; + +// Displays file URL contents inside a modal HTML dialog. +// +// This application really should not use WebContents + DOMUI. It should instead +// just embed a RenderView in a dialog and be done with it. +// +// Before loading a URL corresponding to this DOMUI, the caller should set its +// delegate as a property on the WebContents. This DOMUI will pick it up from +// there and call it back. This is a bit of a hack to allow the dialog to pass +// its delegate to the DOM UI without having nasty accessors on the WebContents. +// The correct design using RVH directly would avoid all of this. +class HtmlDialogUI : public DOMUI { + public: + struct HtmlDialogParams { + // The URL for the content that will be loaded in the dialog. + GURL url; + // Width of the dialog. + int width; + // Height of the dialog. + int height; + // The JSON input to pass to the dialog when showing it. + std::string json_input; + }; + + // When created, the property should already be set on the WebContents. + HtmlDialogUI(WebContents* web_contents); + virtual ~HtmlDialogUI(); + + // Returns the PropertyBag accessor object used to write the delegate pointer + // into the WebContents (see class-level comment above). + static PropertyAccessor<HtmlDialogUIDelegate*>& GetPropertyAccessor(); + + private: + // DOMUI overrides. + virtual void RenderViewCreated(RenderViewHost* render_view_host); + + // JS message handler. + void OnDialogClosed(const Value* content); + + DISALLOW_COPY_AND_ASSIGN(HtmlDialogUI); +}; + +#endif // CHROME_BROWSER_DOM_UI_HTML_DIALOG_UI_H_ diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 3f878dc..db98770 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -425,7 +425,7 @@ void BrowserWindowGtk::ShowNewProfileDialog() { NOTIMPLEMENTED(); } -void BrowserWindowGtk::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, +void BrowserWindowGtk::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, void* parent_window) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h index b161b6e..4825499 100644 --- a/chrome/browser/gtk/browser_window_gtk.h +++ b/chrome/browser/gtk/browser_window_gtk.h @@ -73,7 +73,7 @@ class BrowserWindowGtk : public BrowserWindow, virtual void ShowPasswordManager(); virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); - virtual void ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, + virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, void* parent_window); // Overridden from TabStripModelObserver: diff --git a/chrome/browser/modal_html_dialog_delegate.cc b/chrome/browser/modal_html_dialog_delegate.cc index 68d364c..54be702 100644 --- a/chrome/browser/modal_html_dialog_delegate.cc +++ b/chrome/browser/modal_html_dialog_delegate.cc @@ -6,6 +6,7 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/renderer_host/render_view_host.h" +#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/notification_service.h" ModalHtmlDialogDelegate::ModalHtmlDialogDelegate( diff --git a/chrome/browser/modal_html_dialog_delegate.h b/chrome/browser/modal_html_dialog_delegate.h index a2bca1c..a17679f 100644 --- a/chrome/browser/modal_html_dialog_delegate.h +++ b/chrome/browser/modal_html_dialog_delegate.h @@ -8,12 +8,13 @@ #include <vector> #include "base/gfx/size.h" -#include "chrome/browser/dom_ui/html_dialog_contents.h" +#include "chrome/browser/dom_ui/html_dialog_ui.h" +#include "chrome/common/ipc_message.h" #include "chrome/common/notification_observer.h" // This class can only be used on the UI thread. class ModalHtmlDialogDelegate - : public HtmlDialogContentsDelegate, + : public HtmlDialogUIDelegate, public NotificationObserver { public: ModalHtmlDialogDelegate(const GURL& url, @@ -28,7 +29,7 @@ class ModalHtmlDialogDelegate const NotificationSource& source, const NotificationDetails& details); - // HTMLDialogContentsDelegate implementation: + // HTMLDialogUIDelegate implementation: virtual bool IsDialogModal() const; virtual std::wstring GetDialogTitle() const { return L"Google Gears"; } virtual GURL GetDialogContentURL() const; @@ -46,7 +47,7 @@ class ModalHtmlDialogDelegate WebContents* contents_; // The parameters needed to display a modal HTML dialog. - HtmlDialogContents::HtmlDialogParams params_; + HtmlDialogUI::HtmlDialogParams params_; // Once we get our reply in OnModalDialogResponse we'll need to respond to the // plugin using this |sync_result| pointer so we store it between calls. diff --git a/chrome/browser/navigation_controller_unittest.cc b/chrome/browser/navigation_controller_unittest.cc index f2d6f26..57a602d 100644 --- a/chrome/browser/navigation_controller_unittest.cc +++ b/chrome/browser/navigation_controller_unittest.cc @@ -59,7 +59,6 @@ class NavigationControllerTest : public testing::Test, contents = new TestTabContents(type1()); contents->set_delegate(this); - contents->CreateView(); contents->SetupController(profile); } diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 979d7e5..81b87a9 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -578,14 +578,14 @@ bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { if (!active_entry) return false; - // Don't inspect HTML dialogs. - if (source_web_contents_->type() == TAB_CONTENTS_HTML_DIALOG) - return false; - // Don't inspect view source. if (active_entry->IsViewSourceMode()) return false; + // Don't inspect HTML dialogs (doesn't work anyway). + if (active_entry->url().SchemeIs(chrome::kGearsScheme)) + return false; + // Don't inspect inspector, new tab UI, etc. if (active_entry->url().SchemeIs(chrome::kChromeUIScheme)) return false; diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 3188b7c..b20c3e3 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -363,10 +363,6 @@ class TabContents : public PageNavigator, return GetNativeView(); } - // Tell the subclass to set up the view (e.g. create the container HWND if - // applicable) and any other create-time setup. - virtual void CreateView() {} - // Returns the NativeView associated with this TabContents. Outside of // automation in the context of the UI, this is required to be implemented. virtual gfx::NativeView GetNativeView() const { return NULL; } diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index b7b0825..19cc4ec 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -11,7 +11,7 @@ #include "chrome/common/navigation_types.h" class TabContents; -class HtmlDialogContentsDelegate; +class HtmlDialogUIDelegate; // Objects implement this interface to get notified about changes in the // TabContents and to provide necessary functionality. @@ -123,7 +123,7 @@ class TabContentsDelegate : public PageNavigator { // delegate who knows how to display the dialog (which file URL and JSON // string input to use during initialization). |parent_window| is the window // that should be parent of the dialog, or NULL for the default. - virtual void ShowHtmlDialog(HtmlDialogContentsDelegate* delegate, + virtual void ShowHtmlDialog(HtmlDialogUIDelegate* delegate, void* parent_window) { } // Tells us that we've finished firing this tab's beforeunload event. diff --git a/chrome/browser/tab_contents/tab_contents_factory.cc b/chrome/browser/tab_contents/tab_contents_factory.cc index 034ea60..b7ef10e 100644 --- a/chrome/browser/tab_contents/tab_contents_factory.cc +++ b/chrome/browser/tab_contents/tab_contents_factory.cc @@ -16,7 +16,6 @@ #if defined(OS_WIN) // TODO(port): port these headers to posix. -#include "chrome/browser/dom_ui/html_dialog_contents.h" #include "chrome/browser/tab_contents/tab_contents.h" #elif defined(OS_POSIX) #include "chrome/common/temp_scaffolding_stubs.h" @@ -48,12 +47,6 @@ TabContents* TabContents::CreateWithType(TabContentsType type, contents = new WebContents(profile, instance, NULL, MSG_ROUTING_NONE, NULL); break; -#if defined(OS_WIN) - // TODO(brettw) This extra tab contents type should be deleted. - case TAB_CONTENTS_HTML_DIALOG: - contents = new HtmlDialogContents(profile, instance, NULL); - break; -#endif // defined(OS_WIN) default: if (g_extra_types) { TabContentsFactoryMap::const_iterator it = g_extra_types->find(type); @@ -66,9 +59,6 @@ TabContents* TabContents::CreateWithType(TabContentsType type, contents = NULL; } - if (contents) - contents->CreateView(); - return contents; } @@ -93,9 +83,6 @@ TabContentsType TabContents::TypeForURL(GURL* url) { if (BrowserURLHandler::HandleBrowserURL(url, &type)) return type; - if (HtmlDialogContents::IsHtmlDialogUrl(*url)) - return TAB_CONTENTS_HTML_DIALOG; - #elif defined(OS_POSIX) TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE); if (BrowserURLHandler::HandleBrowserURL(url, &type)) { diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index 5e1d3bb..c4746a1 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -217,6 +217,8 @@ WebContents::WebContents(Profile* profile, render_manager_.Init(profile, site_instance, routing_id, modal_dialog_event); + view_->CreateView(); + // Register for notifications about all interested prefs change. PrefService* prefs = profile->GetPrefs(); if (prefs) { @@ -558,11 +560,6 @@ bool WebContents::FocusLocationBarByDefault() { return false; } -// Stupid view pass-throughs -void WebContents::CreateView() { - view_->CreateView(); -} - gfx::NativeView WebContents::GetNativeView() const { return view_->GetNativeView(); } @@ -1200,7 +1197,7 @@ void WebContents::ShowModalHTMLDialog(const GURL& url, int width, int height, const std::string& json_arguments, IPC::Message* reply_msg) { if (delegate()) { - ModalHtmlDialogDelegate* dialog_delegate = + HtmlDialogUIDelegate* dialog_delegate = new ModalHtmlDialogDelegate(url, width, height, json_arguments, reply_msg, this); delegate()->ShowHtmlDialog(dialog_delegate, NULL); @@ -2021,7 +2018,7 @@ DOMUI* WebContents::GetDOMUIForCurrentState() { // - First load in first tab: no committed nav entry + pending nav entry + // pending dom ui: // -> Use pending DOM UI if any. - // + // // - First load in second tab: no committed nav entry + pending nav entry + // no pending DOM UI: // -> Use the committed DOM UI if any. diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h index 75984df..a6c24af 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -156,7 +156,6 @@ class WebContents : public TabContents, // Retarded pass-throughs to the view. // TODO(brettw) fix this, tab contents shouldn't have these methods, probably // it should be killed altogether. - virtual void CreateView(); virtual gfx::NativeView GetNativeView() const; virtual gfx::NativeView GetContentNativeView(); virtual void GetContainerBounds(gfx::Rect *out) const; diff --git a/chrome/browser/tab_contents/web_contents_view.cc b/chrome/browser/tab_contents/web_contents_view.cc index e472ef4..14cb744 100644 --- a/chrome/browser/tab_contents/web_contents_view.cc +++ b/chrome/browser/tab_contents/web_contents_view.cc @@ -37,8 +37,6 @@ void WebContentsView::CreateNewWindow(int route_id, new_contents->SetupController(web_contents()->profile()); WebContentsView* new_view = new_contents->view(); - new_view->CreateView(); - // TODO(brettw) it seems bogus that we have to call this function on the // newly created object and give it one of its own member variables. new_view->CreateViewForWidget(new_contents->render_view_host()); diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/views/dom_view.cc index bd7f7df..9af3b66 100644 --- a/chrome/browser/views/dom_view.cc +++ b/chrome/browser/views/dom_view.cc @@ -6,35 +6,31 @@ #include "chrome/browser/dom_ui/dom_ui_host.h" -DOMView::DOMView(const GURL& contents) - : contents_(contents), initialized_(false), host_(NULL) { +DOMView::DOMView() : initialized_(false), web_contents_(NULL) { SetFocusable(true); } DOMView::~DOMView() { - if (host_) { + if (web_contents_) { Detach(); - host_->Destroy(); - host_ = NULL; + web_contents_->Destroy(); + web_contents_ = NULL; } } bool DOMView::Init(Profile* profile, SiteInstance* instance) { if (initialized_) return true; - initialized_ = true; - - // TODO(timsteele): This should use a separate factory method; e.g - // a DOMUIHostFactory rather than TabContentsFactory, because DOMView's - // should only be associated with instances of DOMUIHost. - TabContentsType type = TabContents::TypeForURL(&contents_); - TabContents* tab_contents = TabContents::CreateWithType(type, profile, - instance); - host_ = tab_contents->AsDOMUIHost(); - DCHECK(host_); - views::HWNDView::Attach(host_->GetNativeView()); - host_->SetupController(profile); - host_->controller()->LoadURL(contents_, GURL(), PageTransition::START_PAGE); + initialized_ = true; + web_contents_ = new WebContents(profile, instance, NULL, + MSG_ROUTING_NONE, NULL); + views::HWNDView::Attach(web_contents_->GetNativeView()); + web_contents_->SetupController(profile); return true; } + +void DOMView::LoadURL(const GURL& url) { + DCHECK(initialized_); + web_contents_->controller()->LoadURL(url, GURL(), PageTransition::START_PAGE); +} diff --git a/chrome/browser/views/dom_view.h b/chrome/browser/views/dom_view.h index 3a4e6d0..bfa6d13 100644 --- a/chrome/browser/views/dom_view.h +++ b/chrome/browser/views/dom_view.h @@ -11,29 +11,32 @@ #include "chrome/views/controls/hwnd_view.h" #include "googleurl/src/gurl.h" -class DOMUIHost; class Profile; class SiteInstance; +class WebContents; class DOMView : public views::HWNDView { public: // Construct a DOMView to display the given data: URL. - explicit DOMView(const GURL& contents); + explicit DOMView(); virtual ~DOMView(); - // Initialize the view, causing it to load its contents. This should be + // Initialize the view, creating the contents. This should be // called once the view has been added to a container. + // // If |instance| is not null, then the view will be loaded in the same // process as the given instance. bool Init(Profile* profile, SiteInstance* instance); + // Loads the given URL into the page. You must have previously called Init(). + void LoadURL(const GURL& url); + protected: virtual bool CanProcessTabKeyEvents() { return true; } - DOMUIHost* host_; + WebContents* web_contents_; private: - GURL contents_; bool initialized_; DISALLOW_COPY_AND_ASSIGN(DOMView); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index d0c3e07..f5341d6 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -822,7 +822,7 @@ void BrowserView::ShowNewProfileDialog() { NewProfileDialog::RunDialog(); } -void BrowserView::ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, +void BrowserView::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, void* parent_window) { HWND parent_hwnd = reinterpret_cast<HWND>(parent_window); parent_hwnd = parent_hwnd ? parent_hwnd : GetWidget()->GetNativeView(); diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 6386999..d23b76d 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -26,6 +26,7 @@ class BrowserToolbarView; class EncodingMenuControllerDelegate; class FindBarController; class FullscreenExitBubble; +class HtmlDialogUIDelegate; class InfoBarContainer; class Menu; class StatusBubbleViews; @@ -200,7 +201,7 @@ class BrowserView : public BrowserWindow, virtual void ShowPasswordManager(); virtual void ShowSelectProfileDialog(); virtual void ShowNewProfileDialog(); - virtual void ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, + virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, void* parent_window); virtual bool GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible) const; diff --git a/chrome/browser/views/html_dialog_view.cc b/chrome/browser/views/html_dialog_view.cc index c26bdaf..ecb459c 100644 --- a/chrome/browser/views/html_dialog_view.cc +++ b/chrome/browser/views/html_dialog_view.cc @@ -5,6 +5,7 @@ #include "chrome/browser/views/html_dialog_view.h" #include "chrome/browser/browser.h" +#include "chrome/browser/tab_contents/web_contents.h" #include "chrome/views/widget/root_view.h" #include "chrome/views/window/window.h" @@ -13,8 +14,8 @@ HtmlDialogView::HtmlDialogView(Browser* parent_browser, Profile* profile, - HtmlDialogContentsDelegate* delegate) - : DOMView(delegate->GetDialogContentURL()), + HtmlDialogUIDelegate* delegate) + : DOMView(), parent_browser_(parent_browser), profile_(profile), delegate_(delegate) { @@ -66,7 +67,7 @@ views::View* HtmlDialogView::GetInitiallyFocusedView() { } //////////////////////////////////////////////////////////////////////////////// -// HtmlDialogContentsDelegate implementation: +// HtmlDialogUIDelegate implementation: bool HtmlDialogView::IsDialogModal() const { return IsModal(); @@ -122,10 +123,10 @@ void HtmlDialogView::ReplaceContents(TabContents* source, } void HtmlDialogView::AddNewContents(TabContents* source, - TabContents* new_contents, - WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, - bool user_gesture) { + TabContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) { parent_browser_->AddNewContents( source, new_contents, NEW_WINDOW, initial_pos, user_gesture); } @@ -177,9 +178,10 @@ void HtmlDialogView::InitDialog() { // Now Init the DOMView. This view runs in its own process to render the html. DOMView::Init(profile_, NULL); - // Make sure this new TabContents we just created in Init() knows about us. - DCHECK(host_->type() == TAB_CONTENTS_HTML_DIALOG); - HtmlDialogContents* host = static_cast<HtmlDialogContents*>(host_); - host->Init(this); - host->set_delegate(this); + // Set the delegate. This must be done before loading the page. See + // the comment above HtmlDialogUI in its header file for why. + HtmlDialogUI::GetPropertyAccessor().SetProperty(web_contents_->property_bag(), + this); + + DOMView::LoadURL(delegate_->GetDialogContentURL()); } diff --git a/chrome/browser/views/html_dialog_view.h b/chrome/browser/views/html_dialog_view.h index 54bace6..bdff126 100644 --- a/chrome/browser/views/html_dialog_view.h +++ b/chrome/browser/views/html_dialog_view.h @@ -8,7 +8,7 @@ #include <string> #include "base/gfx/size.h" -#include "chrome/browser/dom_ui/html_dialog_contents.h" +#include "chrome/browser/dom_ui/html_dialog_ui.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/browser/views/dom_view.h" #include "chrome/views/window/window_delegate.h" @@ -22,7 +22,7 @@ class Window; // // HtmlDialogView is a view used to display an HTML dialog to the user. The // content of the dialogs is determined by the delegate -// (HtmlDialogContentsDelegate), but is basically a file URL along with a +// (HtmlDialogUIDelegate), but is basically a file URL along with a // JSON input string. The HTML is supposed to show a UI to the user and is // expected to send back a JSON file as a return value. // @@ -30,12 +30,12 @@ class Window; class HtmlDialogView : public DOMView, public TabContentsDelegate, - public HtmlDialogContentsDelegate, + public HtmlDialogUIDelegate, public views::WindowDelegate { public: HtmlDialogView(Browser* parent_browser, Profile* profile, - HtmlDialogContentsDelegate* delegate); + HtmlDialogUIDelegate* delegate); virtual ~HtmlDialogView(); // Initializes the contents of the dialog (the DOMView and the callbacks). @@ -52,7 +52,7 @@ class HtmlDialogView virtual views::View* GetContentsView(); virtual views::View* GetInitiallyFocusedView(); - // Overridden from HtmlDialogContentsDelegate: + // Overridden from HtmlDialogUI::Delegate: virtual bool IsDialogModal() const; virtual std::wstring GetDialogTitle() const; virtual GURL GetDialogContentURL() const; @@ -95,7 +95,7 @@ class HtmlDialogView // about when the dialog is closing. For all other actions (besides dialog // closing) we delegate to the creator of this view, which we keep track of // using this variable. - HtmlDialogContentsDelegate* delegate_; + HtmlDialogUIDelegate* delegate_; DISALLOW_COPY_AND_ASSIGN(HtmlDialogView); }; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 199a69d3..43b1412 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -592,8 +592,8 @@ 'browser/dom_ui/fileicon_source.h', 'browser/dom_ui/history_ui.cc', 'browser/dom_ui/history_ui.h', - 'browser/dom_ui/html_dialog_contents.cc', - 'browser/dom_ui/html_dialog_contents.h', + 'browser/dom_ui/html_dialog_ui.cc', + 'browser/dom_ui/html_dialog_ui.h', 'browser/dom_ui/new_tab_ui.cc', 'browser/dom_ui/new_tab_ui.h', 'browser/download/download_exe.cc', diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 216756f..510e42e 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -24,6 +24,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/cancelable_request.h" +#include "chrome/browser/dom_ui/html_dialog_ui.h" #include "chrome/browser/download/download_shelf.h" #include "chrome/browser/download/save_types.h" #include "chrome/browser/history/download_types.h" @@ -428,7 +429,7 @@ class SelectFileDialog : public base::RefCountedThreadSafe<SelectFileDialog> { void ListenerDestroyed() { NOTIMPLEMENTED(); } void SelectFile(Type, const std::wstring&, const std::wstring&, const std::wstring&, int, const std::wstring&, - gfx::NativeWindow, void*) { NOTIMPLEMENTED(); } + gfx::NativeWindow, void*) { NOTIMPLEMENTED(); } static SelectFileDialog* Create(WebContents*) { NOTIMPLEMENTED(); return new SelectFileDialog; @@ -543,14 +544,17 @@ class ConstrainedWindow { void CloseConstrainedWindow() { NOTIMPLEMENTED(); } }; -class HtmlDialogContentsDelegate { - public: -}; - -class ModalHtmlDialogDelegate : public HtmlDialogContentsDelegate { +class ModalHtmlDialogDelegate : public HtmlDialogUIDelegate { public: ModalHtmlDialogDelegate(const GURL&, int, int, const std::string&, IPC::Message*, WebContents*) { } + + virtual bool IsDialogModal() const { return true; } + virtual std::wstring GetDialogTitle() const { return std::wstring(); } + virtual GURL GetDialogContentURL() const { return GURL(); } + virtual void GetDialogSize(gfx::Size* size) const {} + virtual std::string GetDialogArgs() const { return std::string(); } + virtual void OnDialogClosed(const std::string& json_retval) {} }; class HtmlDialogContents { diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 0b1469b..07d5de7 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -16,6 +16,7 @@ const char kDataScheme[] = "data"; const char kExtensionScheme[] = "chrome-extension"; const char kFileScheme[] = "file"; const char kFtpScheme[] = "ftp"; +const char kGearsScheme[] = "gears"; const char kHttpScheme[] = "http"; const char kHttpsScheme[] = "https"; const char kJavaScriptScheme[] = "javascript"; @@ -45,6 +46,7 @@ const char kChromeUINewTabURL[] = "chrome-ui://newtab"; #endif const char kChromeUIDevToolsHost[] = "devtools"; +const char kChromeUIDialogHost[] = "dialog"; const char kChromeUIDownloadsHost[] = "downloads"; const char kChromeUIExtensionsHost[] = "extensions"; const char kChromeUIFavIconPath[] = "favicon"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 88faaaf..163d2da 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -17,6 +17,7 @@ extern const char kDataScheme[]; extern const char kExtensionScheme[]; extern const char kFileScheme[]; extern const char kFtpScheme[]; +extern const char kGearsScheme[]; extern const char kHttpScheme[]; extern const char kHttpsScheme[]; extern const char kJavaScriptScheme[]; @@ -47,6 +48,7 @@ extern const char kChromeUINewTabURL[]; // chrome-ui components of URLs. Should be kept in sync with the full URLs // above. extern const char kChromeUIDevToolsHost[]; +extern const char kChromeUIDialogHost[]; extern const char kChromeUIDownloadsHost[]; extern const char kChromeUIExtensionsHost[]; extern const char kChromeUIFavIconPath[]; diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h index 242995d..bf8890f 100644 --- a/chrome/test/test_browser_window.h +++ b/chrome/test/test_browser_window.h @@ -60,7 +60,7 @@ class TestBrowserWindow : public BrowserWindow { virtual void ShowPasswordManager() {} virtual void ShowSelectProfileDialog() {} virtual void ShowNewProfileDialog() {} - virtual void ShowHTMLDialog(HtmlDialogContentsDelegate* delegate, + virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, void* parent_window) {} virtual bool GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible) const { return false; } |