| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/gtk/web_dialog_gtk.h" | 5 #include "chrome/browser/ui/gtk/web_dialog_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/property_bag.h" | 9 #include "base/property_bag.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_dialogs.h" | 13 #include "chrome/browser/ui/browser_dialogs.h" |
| 14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/browser/ui/gtk/gtk_util.h" | 15 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 16 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" | 16 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 18 #include "chrome/browser/ui/webui/web_dialog_controller.h" | 18 #include "chrome/browser/ui/webui/web_dialog_controller.h" |
| 19 #include "content/public/browser/native_web_keyboard_event.h" | 19 #include "content/public/browser/native_web_keyboard_event.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "ui/web_dialogs/web_dialog_ui.h" | 21 #include "ui/web_dialogs/web_dialog_ui.h" |
| 22 | 22 |
| 23 using content::NativeWebKeyboardEvent; | 23 using content::NativeWebKeyboardEvent; |
| 24 using content::WebContents; | 24 using content::WebContents; |
| 25 using content::WebUIMessageHandler; | 25 using content::WebUIMessageHandler; |
| 26 using ui::WebDialogDelegate; | 26 using ui::WebDialogDelegate; |
| 27 using ui::WebDialogUI; | 27 using ui::WebDialogUI; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 // To make sure the default key bindings can still work, such as Escape to | 204 // To make sure the default key bindings can still work, such as Escape to |
| 205 // close the dialog. | 205 // close the dialog. |
| 206 gtk_bindings_activate_event(GTK_OBJECT(dialog_), os_event); | 206 gtk_bindings_activate_event(GTK_OBJECT(dialog_), os_event); |
| 207 } | 207 } |
| 208 | 208 |
| 209 //////////////////////////////////////////////////////////////////////////////// | 209 //////////////////////////////////////////////////////////////////////////////// |
| 210 // WebDialogGtk: | 210 // WebDialogGtk: |
| 211 | 211 |
| 212 gfx::NativeWindow WebDialogGtk::InitDialog() { | 212 gfx::NativeWindow WebDialogGtk::InitDialog() { |
| 213 tab_.reset(new TabContentsWrapper( | 213 tab_.reset(new TabContents( |
| 214 WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); | 214 WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); |
| 215 tab_->web_contents()->SetDelegate(this); | 215 tab_->web_contents()->SetDelegate(this); |
| 216 | 216 |
| 217 // This must be done before loading the page; see the comments in | 217 // This must be done before loading the page; see the comments in |
| 218 // WebDialogUI. | 218 // WebDialogUI. |
| 219 WebDialogUI::GetPropertyAccessor().SetProperty( | 219 WebDialogUI::GetPropertyAccessor().SetProperty( |
| 220 tab_->web_contents()->GetPropertyBag(), this); | 220 tab_->web_contents()->GetPropertyBag(), this); |
| 221 | 221 |
| 222 tab_->web_contents()->GetController().LoadURL( | 222 tab_->web_contents()->GetController().LoadURL( |
| 223 GetDialogContentURL(), | 223 GetDialogContentURL(), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 | 262 |
| 263 gtk_widget_show_all(dialog_); | 263 gtk_widget_show_all(dialog_); |
| 264 | 264 |
| 265 return GTK_WINDOW(dialog_); | 265 return GTK_WINDOW(dialog_); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void WebDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { | 268 void WebDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { |
| 269 OnDialogClosed(std::string()); | 269 OnDialogClosed(std::string()); |
| 270 } | 270 } |
| OLD | NEW |