| 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 "chrome/browser/ui/native_web_contents_modal_dialog_manager.h" | 7 #include "components/web_modal/native_web_contents_modal_dialog_manager.h" |
| 8 #include "chrome/browser/ui/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; |
| 13 using web_modal::NativeWebContentsModalDialogManagerDelegate; |
| 14 |
| 12 namespace { | 15 namespace { |
| 13 | 16 |
| 14 // 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 |
| 15 // Win32 system, ConstrainedWindowGtk doesn't draw draggable fake windows and | 18 // Win32 system, ConstrainedWindowGtk doesn't draw draggable fake windows and |
| 16 // 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. |
| 17 class NativeWebContentsModalDialogManagerGtk | 20 class NativeWebContentsModalDialogManagerGtk |
| 18 : public NativeWebContentsModalDialogManager { | 21 : public web_modal::NativeWebContentsModalDialogManager { |
| 19 public: | 22 public: |
| 20 NativeWebContentsModalDialogManagerGtk( | 23 NativeWebContentsModalDialogManagerGtk( |
| 21 NativeWebContentsModalDialogManagerDelegate* native_delegate) | 24 NativeWebContentsModalDialogManagerDelegate* native_delegate) |
| 22 : native_delegate_(native_delegate), | 25 : native_delegate_(native_delegate), |
| 23 shown_widget_(NULL) { | 26 shown_widget_(NULL) { |
| 24 } | 27 } |
| 25 | 28 |
| 26 virtual ~NativeWebContentsModalDialogManagerGtk() { | 29 virtual ~NativeWebContentsModalDialogManagerGtk() { |
| 27 } | 30 } |
| 28 | 31 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 shown_widget_ = NULL; | 138 shown_widget_ = NULL; |
| 136 } | 139 } |
| 137 | 140 |
| 138 native_delegate_->WillClose(sender); | 141 native_delegate_->WillClose(sender); |
| 139 | 142 |
| 140 g_object_unref(sender); | 143 g_object_unref(sender); |
| 141 } | 144 } |
| 142 | 145 |
| 143 } // namespace | 146 } // namespace |
| 144 | 147 |
| 148 namespace web_modal { |
| 149 |
| 145 NativeWebContentsModalDialogManager* | 150 NativeWebContentsModalDialogManager* |
| 146 WebContentsModalDialogManager::CreateNativeManager( | 151 WebContentsModalDialogManager::CreateNativeManager( |
| 147 NativeWebContentsModalDialogManagerDelegate* native_delegate) { | 152 NativeWebContentsModalDialogManagerDelegate* native_delegate) { |
| 148 return new NativeWebContentsModalDialogManagerGtk(native_delegate); | 153 return new NativeWebContentsModalDialogManagerGtk(native_delegate); |
| 149 } | 154 } |
| 155 |
| 156 } // namespace web_modal |
| OLD | NEW |