| 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/extensions/extension_popup_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "chrome/browser/debugger/devtools_window.h" | 16 #include "chrome/browser/debugger/devtools_window.h" |
| 17 #include "chrome/browser/extensions/extension_host.h" | 17 #include "chrome/browser/extensions/extension_host.h" |
| 18 #include "chrome/browser/extensions/extension_process_manager.h" | 18 #include "chrome/browser/extensions/extension_process_manager.h" |
| 19 #include "chrome/browser/extensions/extension_system.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
| 22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 23 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 23 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
| 24 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
| 25 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
| 26 #include "content/public/browser/render_view_host.h" | 27 #include "content/public/browser/render_view_host.h" |
| 27 #include "content/public/browser/render_widget_host_view.h" | 28 #include "content/public/browser/render_widget_host_view.h" |
| 28 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 73 } |
| 73 } | 74 } |
| 74 | 75 |
| 75 ExtensionPopupGtk::~ExtensionPopupGtk() { | 76 ExtensionPopupGtk::~ExtensionPopupGtk() { |
| 76 } | 77 } |
| 77 | 78 |
| 78 // static | 79 // static |
| 79 void ExtensionPopupGtk::Show(const GURL& url, Browser* browser, | 80 void ExtensionPopupGtk::Show(const GURL& url, Browser* browser, |
| 80 GtkWidget* anchor, ShowAction show_action) { | 81 GtkWidget* anchor, ShowAction show_action) { |
| 81 ExtensionProcessManager* manager = | 82 ExtensionProcessManager* manager = |
| 82 browser->profile()->GetExtensionProcessManager(); | 83 extensions::ExtensionSystem::Get(browser->profile())->process_manager(); |
| 83 DCHECK(manager); | 84 DCHECK(manager); |
| 84 if (!manager) | 85 if (!manager) |
| 85 return; | 86 return; |
| 86 | 87 |
| 87 extensions::ExtensionHost* host = manager->CreatePopupHost(url, browser); | 88 extensions::ExtensionHost* host = manager->CreatePopupHost(url, browser); |
| 88 // This object will delete itself when the bubble is closed. | 89 // This object will delete itself when the bubble is closed. |
| 89 new ExtensionPopupGtk(browser, host, anchor, show_action); | 90 new ExtensionPopupGtk(browser, host, anchor, show_action); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void ExtensionPopupGtk::Observe(int type, | 93 void ExtensionPopupGtk::Observe(int type, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 201 |
| 201 void ExtensionPopupGtk::DestroyPopupWithoutResult() { | 202 void ExtensionPopupGtk::DestroyPopupWithoutResult() { |
| 202 DestroyPopup(); | 203 DestroyPopup(); |
| 203 } | 204 } |
| 204 | 205 |
| 205 gfx::Rect ExtensionPopupGtk::GetViewBounds() { | 206 gfx::Rect ExtensionPopupGtk::GetViewBounds() { |
| 206 GtkAllocation allocation; | 207 GtkAllocation allocation; |
| 207 gtk_widget_get_allocation(host_->view()->native_view(), &allocation); | 208 gtk_widget_get_allocation(host_->view()->native_view(), &allocation); |
| 208 return gfx::Rect(allocation); | 209 return gfx::Rect(allocation); |
| 209 } | 210 } |
| OLD | NEW |