| OLD | NEW | 
|    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2011 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/i18n/rtl.h" |   11 #include "base/i18n/rtl.h" | 
|   12 #include "base/message_loop.h" |   12 #include "base/message_loop.h" | 
|   13 #include "chrome/browser/extensions/extension_host.h" |   13 #include "chrome/browser/extensions/extension_host.h" | 
|   14 #include "chrome/browser/extensions/extension_process_manager.h" |   14 #include "chrome/browser/extensions/extension_process_manager.h" | 
|   15 #include "chrome/browser/profiles/profile.h" |   15 #include "chrome/browser/profiles/profile.h" | 
|   16 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" |   16 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" | 
|   17 #include "chrome/browser/ui/browser.h" |   17 #include "chrome/browser/ui/browser.h" | 
|   18 #include "chrome/browser/ui/browser_window.h" |   18 #include "chrome/browser/ui/browser_window.h" | 
|   19 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |   19 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 
|   20 #include "content/browser/debugger/devtools_manager.h" |   20 #include "content/browser/debugger/devtools_window.h" | 
|   21 #include "content/browser/renderer_host/render_view_host.h" |   21 #include "content/browser/renderer_host/render_view_host.h" | 
|   22 #include "content/common/notification_details.h" |   22 #include "content/common/notification_details.h" | 
|   23 #include "content/common/notification_source.h" |   23 #include "content/common/notification_source.h" | 
|   24 #include "googleurl/src/gurl.h" |   24 #include "googleurl/src/gurl.h" | 
|   25  |   25  | 
|   26 ExtensionPopupGtk* ExtensionPopupGtk::current_extension_popup_ = NULL; |   26 ExtensionPopupGtk* ExtensionPopupGtk::current_extension_popup_ = NULL; | 
|   27  |   27  | 
|   28 // The minimum/maximum dimensions of the extension popup. |   28 // The minimum/maximum dimensions of the extension popup. | 
|   29 // The minimum is just a little larger than the size of a browser action button. |   29 // The minimum is just a little larger than the size of a browser action button. | 
|   30 // The maximum is an arbitrary number that should be smaller than most screens. |   30 // The maximum is an arbitrary number that should be smaller than most screens. | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   89   } |   89   } | 
|   90 } |   90 } | 
|   91  |   91  | 
|   92 void ExtensionPopupGtk::ShowPopup() { |   92 void ExtensionPopupGtk::ShowPopup() { | 
|   93   if (bubble_) { |   93   if (bubble_) { | 
|   94     NOTREACHED(); |   94     NOTREACHED(); | 
|   95     return; |   95     return; | 
|   96   } |   96   } | 
|   97  |   97  | 
|   98   if (being_inspected_) { |   98   if (being_inspected_) { | 
|   99     DevToolsManager::GetInstance()->OpenDevToolsWindow( |   99     DevToolsWindow::OpenDevToolsWindow(host_->render_view_host()); | 
|  100         host_->render_view_host()); |  | 
|  101     // Listen for the the devtools window closing. |  100     // Listen for the the devtools window closing. | 
|  102     registrar_.Add(this, NotificationType::DEVTOOLS_WINDOW_CLOSING, |  101     registrar_.Add(this, NotificationType::DEVTOOLS_WINDOW_CLOSING, | 
|  103         Source<Profile>(host_->profile())); |  102         Source<Profile>(host_->profile())); | 
|  104   } |  103   } | 
|  105  |  104  | 
|  106   // Only one instance should be showing at a time. Get rid of the old one, if |  105   // Only one instance should be showing at a time. Get rid of the old one, if | 
|  107   // any. Typically, |current_extension_popup_| will be NULL, but it can be |  106   // any. Typically, |current_extension_popup_| will be NULL, but it can be | 
|  108   // non-NULL if a browser action button is clicked while another extension |  107   // non-NULL if a browser action button is clicked while another extension | 
|  109   // popup's extension host is still loading. |  108   // popup's extension host is still loading. | 
|  110   if (current_extension_popup_) |  109   if (current_extension_popup_) | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  164     return; |  163     return; | 
|  165  |  164  | 
|  166   ExtensionHost* host = manager->CreatePopupHost(url, browser); |  165   ExtensionHost* host = manager->CreatePopupHost(url, browser); | 
|  167   // This object will delete itself when the bubble is closed. |  166   // This object will delete itself when the bubble is closed. | 
|  168   new ExtensionPopupGtk(browser, host, anchor, inspect); |  167   new ExtensionPopupGtk(browser, host, anchor, inspect); | 
|  169 } |  168 } | 
|  170  |  169  | 
|  171 gfx::Rect ExtensionPopupGtk::GetViewBounds() { |  170 gfx::Rect ExtensionPopupGtk::GetViewBounds() { | 
|  172   return gfx::Rect(host_->view()->native_view()->allocation); |  171   return gfx::Rect(host_->view()->native_view()->allocation); | 
|  173 } |  172 } | 
| OLD | NEW |