| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/gtk_util.h" | 5 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 6 #include "chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_g
tk.h" | 6 #include "chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_g
tk.h" |
| 7 #include "components/web_modal/native_web_contents_modal_dialog_manager.h" | 7 #include "components/web_modal/single_web_contents_dialog_manager.h" |
| 8 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 8 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "ui/base/gtk/focus_store_gtk.h" | 10 #include "ui/base/gtk/focus_store_gtk.h" |
| 11 | 11 |
| 12 using web_modal::NativeWebContentsModalDialog; | 12 using web_modal::NativeWebContentsModalDialog; |
| 13 using web_modal::NativeWebContentsModalDialogManagerDelegate; | 13 using web_modal::SingleWebContentsDialogManagerDelegate; |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Web contents modal dialog manager implementation for the GTK port. Unlike the | 17 // Web contents modal dialog manager implementation for the GTK port. Unlike the |
| 18 // Win32 system, ConstrainedWindowGtk doesn't draw draggable fake windows and | 18 // Win32 system, ConstrainedWindowGtk doesn't draw draggable fake windows and |
| 19 // instead just centers the dialog. It is thus an order of magnitude simpler. | 19 // instead just centers the dialog. It is thus an order of magnitude simpler. |
| 20 class NativeWebContentsModalDialogManagerGtk | 20 class NativeWebContentsModalDialogManagerGtk |
| 21 : public web_modal::NativeWebContentsModalDialogManager { | 21 : public web_modal::SingleWebContentsDialogManager { |
| 22 public: | 22 public: |
| 23 NativeWebContentsModalDialogManagerGtk( | 23 NativeWebContentsModalDialogManagerGtk( |
| 24 NativeWebContentsModalDialogManagerDelegate* native_delegate) | 24 SingleWebContentsDialogManagerDelegate* native_delegate) |
| 25 : native_delegate_(native_delegate), | 25 : native_delegate_(native_delegate), |
| 26 shown_widget_(NULL) { | 26 shown_widget_(NULL) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual ~NativeWebContentsModalDialogManagerGtk() { | 29 virtual ~NativeWebContentsModalDialogManagerGtk() { |
| 30 } | 30 } |
| 31 | 31 |
| 32 // NativeWebContentsModalDialogManager overrides | 32 // SingleWebContentsDialogManager overrides |
| 33 virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE { | 33 virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE { |
| 34 DCHECK(g_object_is_floating(GetGtkWidget(dialog))); | 34 DCHECK(g_object_is_floating(GetGtkWidget(dialog))); |
| 35 g_object_ref_sink(GetGtkWidget(dialog)); | 35 g_object_ref_sink(GetGtkWidget(dialog)); |
| 36 | 36 |
| 37 g_signal_connect(GetGtkWidget(dialog), "hierarchy-changed", | 37 g_signal_connect(GetGtkWidget(dialog), "hierarchy-changed", |
| 38 G_CALLBACK(OnHierarchyChangedThunk), this); | 38 G_CALLBACK(OnHierarchyChangedThunk), this); |
| 39 g_signal_connect(GetGtkWidget(dialog), | 39 g_signal_connect(GetGtkWidget(dialog), |
| 40 "destroy", | 40 "destroy", |
| 41 G_CALLBACK(OnDestroyThunk), | 41 G_CALLBACK(OnDestroyThunk), |
| 42 this); | 42 this); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 native_delegate_->WillClose(sender); | 145 native_delegate_->WillClose(sender); |
| 146 | 146 |
| 147 g_object_unref(sender); | 147 g_object_unref(sender); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace | 150 } // namespace |
| 151 | 151 |
| 152 namespace web_modal { | 152 namespace web_modal { |
| 153 | 153 |
| 154 NativeWebContentsModalDialogManager* | 154 SingleWebContentsDialogManager* |
| 155 WebContentsModalDialogManager::CreateNativeManager( | 155 WebContentsModalDialogManager::CreateNativeWebModalManager( |
| 156 NativeWebContentsModalDialogManagerDelegate* native_delegate) { | 156 SingleWebContentsDialogManagerDelegate* native_delegate) { |
| 157 return new NativeWebContentsModalDialogManagerGtk(native_delegate); | 157 return new NativeWebContentsModalDialogManagerGtk(native_delegate); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace web_modal | 160 } // namespace web_modal |
| OLD | NEW |