| Index: chrome/browser/ui/gtk/web_dialog_gtk.cc
|
| ===================================================================
|
| --- chrome/browser/ui/gtk/web_dialog_gtk.cc (revision 133680)
|
| +++ chrome/browser/ui/gtk/web_dialog_gtk.cc (working copy)
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/ui/gtk/html_dialog_gtk.h"
|
| +#include "chrome/browser/ui/gtk/web_dialog_gtk.h"
|
|
|
| #include <gtk/gtk.h>
|
|
|
| @@ -15,8 +15,8 @@
|
| #include "chrome/browser/ui/gtk/gtk_util.h"
|
| #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h"
|
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
|
| -#include "chrome/browser/ui/webui/html_dialog_controller.h"
|
| -#include "chrome/browser/ui/webui/html_dialog_ui.h"
|
| +#include "chrome/browser/ui/webui/web_dialog_controller.h"
|
| +#include "chrome/browser/ui/webui/web_dialog_ui.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/native_web_keyboard_event.h"
|
|
|
| @@ -25,20 +25,20 @@
|
|
|
| namespace browser {
|
|
|
| -gfx::NativeWindow ShowHtmlDialog(gfx::NativeWindow parent,
|
| - Profile* profile,
|
| - Browser* browser,
|
| - HtmlDialogUIDelegate* delegate,
|
| - DialogStyle style) {
|
| +gfx::NativeWindow ShowWebDialog(gfx::NativeWindow parent,
|
| + Profile* profile,
|
| + Browser* browser,
|
| + WebDialogDelegate* delegate,
|
| + DialogStyle style) {
|
| // Ignore style for now. The style parameter only used in the implementation
|
| - // in html_dialog_view.cc file.
|
| - // TODO (bshe): Add style parameter to HtmlDialogGtk.
|
| - HtmlDialogGtk* html_dialog =
|
| - new HtmlDialogGtk(profile, browser, delegate, parent);
|
| - return html_dialog->InitDialog();
|
| + // in web_dialog_view.cc file.
|
| + // TODO (bshe): Add style parameter to WebDialogGtk.
|
| + WebDialogGtk* web_dialog =
|
| + new WebDialogGtk(profile, browser, delegate, parent);
|
| + return web_dialog->InitDialog();
|
| }
|
|
|
| -void CloseHtmlDialog(gfx::NativeWindow window) {
|
| +void CloseWebDialog(gfx::NativeWindow window) {
|
| gtk_dialog_response(GTK_DIALOG(window), GTK_RESPONSE_CLOSE);
|
| }
|
|
|
| @@ -65,41 +65,41 @@
|
| } // namespace
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// HtmlDialogGtk, public:
|
| +// WebDialogGtk, public:
|
|
|
| -HtmlDialogGtk::HtmlDialogGtk(Profile* profile,
|
| - Browser* browser,
|
| - HtmlDialogUIDelegate* delegate,
|
| - gfx::NativeWindow parent_window)
|
| - : HtmlDialogTabContentsDelegate(profile),
|
| +WebDialogGtk::WebDialogGtk(Profile* profile,
|
| + Browser* browser,
|
| + WebDialogDelegate* delegate,
|
| + gfx::NativeWindow parent_window)
|
| + : WebDialogWebContentsDelegate(profile),
|
| delegate_(delegate),
|
| parent_window_(parent_window),
|
| dialog_(NULL),
|
| - dialog_controller_(new HtmlDialogController(this, profile, browser)) {
|
| + dialog_controller_(new WebDialogController(this, profile, browser)) {
|
| }
|
|
|
| -HtmlDialogGtk::~HtmlDialogGtk() {
|
| +WebDialogGtk::~WebDialogGtk() {
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// HtmlDialogUIDelegate implementation:
|
| +// WebDialogDelegate implementation:
|
|
|
| -ui::ModalType HtmlDialogGtk::GetDialogModalType() const {
|
| +ui::ModalType WebDialogGtk::GetDialogModalType() const {
|
| return delegate_ ? delegate_->GetDialogModalType() : ui::MODAL_TYPE_NONE;
|
| }
|
|
|
| -string16 HtmlDialogGtk::GetDialogTitle() const {
|
| +string16 WebDialogGtk::GetDialogTitle() const {
|
| return delegate_ ? delegate_->GetDialogTitle() : string16();
|
| }
|
|
|
| -GURL HtmlDialogGtk::GetDialogContentURL() const {
|
| +GURL WebDialogGtk::GetDialogContentURL() const {
|
| if (delegate_)
|
| return delegate_->GetDialogContentURL();
|
| else
|
| return GURL();
|
| }
|
|
|
| -void HtmlDialogGtk::GetWebUIMessageHandlers(
|
| +void WebDialogGtk::GetWebUIMessageHandlers(
|
| std::vector<WebUIMessageHandler*>* handlers) const {
|
| if (delegate_)
|
| delegate_->GetWebUIMessageHandlers(handlers);
|
| @@ -107,33 +107,33 @@
|
| handlers->clear();
|
| }
|
|
|
| -void HtmlDialogGtk::GetDialogSize(gfx::Size* size) const {
|
| +void WebDialogGtk::GetDialogSize(gfx::Size* size) const {
|
| if (delegate_)
|
| delegate_->GetDialogSize(size);
|
| else
|
| *size = gfx::Size();
|
| }
|
|
|
| -void HtmlDialogGtk::GetMinimumDialogSize(gfx::Size* size) const {
|
| +void WebDialogGtk::GetMinimumDialogSize(gfx::Size* size) const {
|
| if (delegate_)
|
| delegate_->GetMinimumDialogSize(size);
|
| else
|
| *size = gfx::Size();
|
| }
|
|
|
| -std::string HtmlDialogGtk::GetDialogArgs() const {
|
| +std::string WebDialogGtk::GetDialogArgs() const {
|
| if (delegate_)
|
| return delegate_->GetDialogArgs();
|
| else
|
| return std::string();
|
| }
|
|
|
| -void HtmlDialogGtk::OnDialogClosed(const std::string& json_retval) {
|
| +void WebDialogGtk::OnDialogClosed(const std::string& json_retval) {
|
| DCHECK(dialog_);
|
|
|
| Detach();
|
| if (delegate_) {
|
| - HtmlDialogUIDelegate* dialog_delegate = delegate_;
|
| + WebDialogDelegate* dialog_delegate = delegate_;
|
| delegate_ = NULL; // We will not communicate further with the delegate.
|
|
|
| // Store the dialog bounds.
|
| @@ -147,13 +147,13 @@
|
| delete this;
|
| }
|
|
|
| -void HtmlDialogGtk::OnCloseContents(WebContents* source,
|
| - bool* out_close_dialog) {
|
| +void WebDialogGtk::OnCloseContents(WebContents* source,
|
| + bool* out_close_dialog) {
|
| if (delegate_)
|
| delegate_->OnCloseContents(source, out_close_dialog);
|
| }
|
|
|
| -void HtmlDialogGtk::CloseContents(WebContents* source) {
|
| +void WebDialogGtk::CloseContents(WebContents* source) {
|
| DCHECK(dialog_);
|
|
|
| bool close_dialog = false;
|
| @@ -162,7 +162,7 @@
|
| OnDialogClosed(std::string());
|
| }
|
|
|
| -content::WebContents* HtmlDialogGtk::OpenURLFromTab(
|
| +content::WebContents* WebDialogGtk::OpenURLFromTab(
|
| content::WebContents* source,
|
| const content::OpenURLParams& params) {
|
| content::WebContents* new_contents = NULL;
|
| @@ -170,28 +170,28 @@
|
| delegate_->HandleOpenURLFromTab(source, params, &new_contents)) {
|
| return new_contents;
|
| }
|
| - return HtmlDialogTabContentsDelegate::OpenURLFromTab(source, params);
|
| + return WebDialogWebContentsDelegate::OpenURLFromTab(source, params);
|
| }
|
|
|
| -void HtmlDialogGtk::AddNewContents(content::WebContents* source,
|
| - content::WebContents* new_contents,
|
| - WindowOpenDisposition disposition,
|
| - const gfx::Rect& initial_pos,
|
| - bool user_gesture) {
|
| +void WebDialogGtk::AddNewContents(content::WebContents* source,
|
| + content::WebContents* new_contents,
|
| + WindowOpenDisposition disposition,
|
| + const gfx::Rect& initial_pos,
|
| + bool user_gesture) {
|
| if (delegate_ && delegate_->HandleAddNewContents(
|
| source, new_contents, disposition, initial_pos, user_gesture)) {
|
| return;
|
| }
|
| - HtmlDialogTabContentsDelegate::AddNewContents(
|
| + WebDialogWebContentsDelegate::AddNewContents(
|
| source, new_contents, disposition, initial_pos, user_gesture);
|
| }
|
|
|
| -void HtmlDialogGtk::LoadingStateChanged(content::WebContents* source) {
|
| +void WebDialogGtk::LoadingStateChanged(content::WebContents* source) {
|
| if (delegate_)
|
| delegate_->OnLoadingStateChanged(source);
|
| }
|
|
|
| -bool HtmlDialogGtk::ShouldShowDialogTitle() const {
|
| +bool WebDialogGtk::ShouldShowDialogTitle() const {
|
| return true;
|
| }
|
|
|
| @@ -201,7 +201,7 @@
|
| // A simplified version of BrowserWindowGtk::HandleKeyboardEvent().
|
| // We don't handle global keyboard shortcuts here, but that's fine since
|
| // they're all browser-specific. (This may change in the future.)
|
| -void HtmlDialogGtk::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
|
| +void WebDialogGtk::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
|
| GdkEventKey* os_event = &event.os_event->key;
|
| if (!os_event || event.type == WebKit::WebInputEvent::Char)
|
| return;
|
| @@ -212,16 +212,16 @@
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// HtmlDialogGtk:
|
| +// WebDialogGtk:
|
|
|
| -gfx::NativeWindow HtmlDialogGtk::InitDialog() {
|
| +gfx::NativeWindow WebDialogGtk::InitDialog() {
|
| tab_.reset(new TabContentsWrapper(
|
| WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)));
|
| tab_->web_contents()->SetDelegate(this);
|
|
|
| // This must be done before loading the page; see the comments in
|
| - // HtmlDialogUI.
|
| - HtmlDialogUI::GetPropertyAccessor().SetProperty(
|
| + // WebDialogUI.
|
| + WebDialogUI::GetPropertyAccessor().SetProperty(
|
| tab_->web_contents()->GetPropertyBag(), this);
|
|
|
| tab_->web_contents()->GetController().LoadURL(
|
| @@ -270,6 +270,6 @@
|
| return GTK_WINDOW(dialog_);
|
| }
|
|
|
| -void HtmlDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
|
| +void WebDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
|
| OnDialogClosed(std::string());
|
| }
|
|
|