| 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" | |
| 10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 12 #include "chrome/browser/ui/gtk/gtk_util.h" | 11 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 13 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" | 12 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 15 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 14 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 16 #include "content/public/browser/native_web_keyboard_event.h" | 15 #include "content/public/browser/native_web_keyboard_event.h" |
| 17 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 18 #include "ui/web_dialogs/web_dialog_ui.h" | 17 #include "ui/web_dialogs/web_dialog_ui.h" |
| 19 | 18 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 //////////////////////////////////////////////////////////////////////////////// | 203 //////////////////////////////////////////////////////////////////////////////// |
| 205 // WebDialogGtk: | 204 // WebDialogGtk: |
| 206 | 205 |
| 207 gfx::NativeWindow WebDialogGtk::InitDialog() { | 206 gfx::NativeWindow WebDialogGtk::InitDialog() { |
| 208 tab_.reset(new TabContents(WebContents::Create( | 207 tab_.reset(new TabContents(WebContents::Create( |
| 209 browser_context(), NULL, MSG_ROUTING_NONE, NULL))); | 208 browser_context(), NULL, MSG_ROUTING_NONE, NULL))); |
| 210 tab_->web_contents()->SetDelegate(this); | 209 tab_->web_contents()->SetDelegate(this); |
| 211 | 210 |
| 212 // This must be done before loading the page; see the comments in | 211 // This must be done before loading the page; see the comments in |
| 213 // WebDialogUI. | 212 // WebDialogUI. |
| 214 WebDialogUI::GetPropertyAccessor().SetProperty( | 213 WebDialogUI::SetDelegate(tab_->web_contents(), this); |
| 215 tab_->web_contents()->GetPropertyBag(), this); | |
| 216 | 214 |
| 217 tab_->web_contents()->GetController().LoadURL( | 215 tab_->web_contents()->GetController().LoadURL( |
| 218 GetDialogContentURL(), | 216 GetDialogContentURL(), |
| 219 content::Referrer(), | 217 content::Referrer(), |
| 220 content::PAGE_TRANSITION_START_PAGE, | 218 content::PAGE_TRANSITION_START_PAGE, |
| 221 std::string()); | 219 std::string()); |
| 222 GtkDialogFlags flags = GTK_DIALOG_NO_SEPARATOR; | 220 GtkDialogFlags flags = GTK_DIALOG_NO_SEPARATOR; |
| 223 if (delegate_->GetDialogModalType() != ui::MODAL_TYPE_NONE) | 221 if (delegate_->GetDialogModalType() != ui::MODAL_TYPE_NONE) |
| 224 flags = static_cast<GtkDialogFlags>(flags | GTK_DIALOG_MODAL); | 222 flags = static_cast<GtkDialogFlags>(flags | GTK_DIALOG_MODAL); |
| 225 | 223 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 256 } | 254 } |
| 257 | 255 |
| 258 gtk_widget_show_all(dialog_); | 256 gtk_widget_show_all(dialog_); |
| 259 | 257 |
| 260 return GTK_WINDOW(dialog_); | 258 return GTK_WINDOW(dialog_); |
| 261 } | 259 } |
| 262 | 260 |
| 263 void WebDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { | 261 void WebDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { |
| 264 OnDialogClosed(std::string()); | 262 OnDialogClosed(std::string()); |
| 265 } | 263 } |
| OLD | NEW |