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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_popup.cc

Issue 10162017: Re-reland Propagate OnNativeWidgetMove to delegate/observers, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 8 years, 8 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/views/extensions/extension_popup.h" 5 #include "chrome/browser/ui/views/extensions/extension_popup.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/debugger/devtools_window.h" 9 #include "chrome/browser/debugger/devtools_window.h"
10 #include "chrome/browser/extensions/extension_process_manager.h" 10 #include "chrome/browser/extensions/extension_process_manager.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 extension_host_(host), 64 extension_host_(host),
65 inspect_with_devtools_(false), 65 inspect_with_devtools_(false),
66 close_bubble_factory_(this) { 66 close_bubble_factory_(this) {
67 // Adjust the margin so that contents fit better. 67 // Adjust the margin so that contents fit better.
68 set_margin(views::BubbleBorder::GetCornerRadius() / 2); 68 set_margin(views::BubbleBorder::GetCornerRadius() / 2);
69 SetLayoutManager(new views::FillLayout()); 69 SetLayoutManager(new views::FillLayout());
70 AddChildView(host->view()); 70 AddChildView(host->view());
71 host->view()->SetContainer(this); 71 host->view()->SetContainer(this);
72 // Use OnNativeFocusChange to check for child window activation on deactivate. 72 // Use OnNativeFocusChange to check for child window activation on deactivate.
73 set_close_on_deactivate(false); 73 set_close_on_deactivate(false);
74 // Make the bubble move with its anchor (during inspection, etc.).
75 set_move_with_anchor(true);
74 76
75 // Wait to show the popup until the contained host finishes loading. 77 // Wait to show the popup until the contained host finishes loading.
76 registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 78 registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
77 content::Source<WebContents>(host->host_contents())); 79 content::Source<WebContents>(host->host_contents()));
78 80
79 // Listen for the containing view calling window.close(); 81 // Listen for the containing view calling window.close();
80 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, 82 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
81 content::Source<Profile>(host->profile())); 83 content::Source<Profile>(host->profile()));
82 84
83 // Listen for the dev tools opening on this popup, so we can stop it going 85 // Listen for the dev tools opening on this popup, so we can stop it going
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 GetWidget()->Close(); 120 GetWidget()->Close();
119 } 121 }
120 break; 122 break;
121 case content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING: 123 case content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING:
122 // First check that the devtools are being opened on this popup. 124 // First check that the devtools are being opened on this popup.
123 if (content::Details<RenderViewHost>(host()->render_view_host()) == 125 if (content::Details<RenderViewHost>(host()->render_view_host()) ==
124 details) { 126 details) {
125 // Set inspect_with_devtools_ so the popup will be kept open while 127 // Set inspect_with_devtools_ so the popup will be kept open while
126 // the devtools are open. 128 // the devtools are open.
127 inspect_with_devtools_ = true; 129 inspect_with_devtools_ = true;
128 set_close_on_deactivate(false);
129 } 130 }
130 break; 131 break;
131 default: 132 default:
132 NOTREACHED() << L"Received unexpected notification"; 133 NOTREACHED() << L"Received unexpected notification";
133 } 134 }
134 } 135 }
135 136
136 void ExtensionPopup::OnExtensionSizeChanged(ExtensionView* view) { 137 void ExtensionPopup::OnExtensionSizeChanged(ExtensionView* view) {
137 SizeToContents(); 138 SizeToContents();
138 } 139 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 196
196 if (inspect_with_devtools_) { 197 if (inspect_with_devtools_) {
197 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), 198 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(),
198 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); 199 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE);
199 } 200 }
200 } 201 }
201 202
202 void ExtensionPopup::CloseBubble() { 203 void ExtensionPopup::CloseBubble() {
203 GetWidget()->Close(); 204 GetWidget()->Close();
204 } 205 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/bundle_installed_bubble.cc ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698