Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc

Issue 10837296: Fix a bug where the inspector would not keep event pages alive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yurys Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (host->did_stop_loading()) { 56 if (host->did_stop_loading()) {
57 ShowPopup(); 57 ShowPopup();
58 } else { 58 } else {
59 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 59 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
60 content::Source<Profile>(host->profile())); 60 content::Source<Profile>(host->profile()));
61 } 61 }
62 62
63 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, 63 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
64 content::Source<Profile>(host->profile())); 64 content::Source<Profile>(host->profile()));
65 65
66 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, 66 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_AGENT_DETACHED,
67 content::Source<Profile>(host->profile())); 67 content::Source<Profile>(host->profile()));
68 68
69 if (!being_inspected_) { 69 if (!being_inspected_) {
70 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING, 70 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_AGENT_ATTACHED,
71 content::Source<Profile>(host->profile())); 71 content::Source<Profile>(host->profile()));
72 } 72 }
73 } 73 }
74 74
75 ExtensionPopupGtk::~ExtensionPopupGtk() { 75 ExtensionPopupGtk::~ExtensionPopupGtk() {
76 } 76 }
77 77
78 // static 78 // static
79 void ExtensionPopupGtk::Show(const GURL& url, Browser* browser, 79 void ExtensionPopupGtk::Show(const GURL& url, Browser* browser,
80 GtkWidget* anchor, ShowAction show_action) { 80 GtkWidget* anchor, ShowAction show_action) {
(...skipping 13 matching lines...) Expand all
94 const content::NotificationDetails& details) { 94 const content::NotificationDetails& details) {
95 switch (type) { 95 switch (type) {
96 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: 96 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING:
97 if (content::Details<extensions::ExtensionHost>(host_.get()) == details) 97 if (content::Details<extensions::ExtensionHost>(host_.get()) == details)
98 ShowPopup(); 98 ShowPopup();
99 break; 99 break;
100 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: 100 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE:
101 if (content::Details<extensions::ExtensionHost>(host_.get()) == details) 101 if (content::Details<extensions::ExtensionHost>(host_.get()) == details)
102 DestroyPopup(); 102 DestroyPopup();
103 break; 103 break;
104 case content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING: 104 case content::NOTIFICATION_DEVTOOLS_AGENT_ATTACHED:
105 // Make sure it's the devtools window that is inspecting our popup. 105 // Make sure it's the devtools window that is inspecting our popup.
106 if (content::Details<RenderViewHost>(host_->render_view_host()) != 106 if (content::Details<RenderViewHost>(host_->render_view_host()) !=
107 details) 107 details)
108 break; 108 break;
109 109
110 // Make sure that the popup won't go away when the inspector is activated. 110 // Make sure that the popup won't go away when the inspector is activated.
111 if (bubble_) 111 if (bubble_)
112 bubble_->StopGrabbingInput(); 112 bubble_->StopGrabbingInput();
113 113
114 being_inspected_ = true; 114 being_inspected_ = true;
115 break; 115 break;
116 case content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING: 116 case content::NOTIFICATION_DEVTOOLS_AGENT_DETACHED:
117 // Make sure it's the devtools window that is inspecting our popup. 117 // Make sure it's the devtools window that is inspecting our popup.
118 if (content::Details<RenderViewHost>(host_->render_view_host()) != 118 if (content::Details<RenderViewHost>(host_->render_view_host()) !=
119 details) 119 details)
120 break; 120 break;
121 121
122 // If the devtools window is closing, we post a task to ourselves to 122 // If the devtools window is closing, we post a task to ourselves to
123 // close the popup. This gives the devtools window a chance to finish 123 // close the popup. This gives the devtools window a chance to finish
124 // detaching from the inspected RenderViewHost. 124 // detaching from the inspected RenderViewHost.
125 MessageLoop::current()->PostTask( 125 MessageLoop::current()->PostTask(
126 FROM_HERE, 126 FROM_HERE,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 void ExtensionPopupGtk::DestroyPopupWithoutResult() { 195 void ExtensionPopupGtk::DestroyPopupWithoutResult() {
196 DestroyPopup(); 196 DestroyPopup();
197 } 197 }
198 198
199 gfx::Rect ExtensionPopupGtk::GetViewBounds() { 199 gfx::Rect ExtensionPopupGtk::GetViewBounds() {
200 GtkAllocation allocation; 200 GtkAllocation allocation;
201 gtk_widget_get_allocation(host_->view()->native_view(), &allocation); 201 gtk_widget_get_allocation(host_->view()->native_view(), &allocation);
202 return gfx::Rect(allocation); 202 return gfx::Rect(allocation);
203 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698