| 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/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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 views::BubbleBorder::ArrowLocation arrow_location, | 68 views::BubbleBorder::ArrowLocation arrow_location, |
| 69 ShowAction show_action) | 69 ShowAction show_action) |
| 70 : BubbleDelegateView(anchor_view, arrow_location), | 70 : BubbleDelegateView(anchor_view, arrow_location), |
| 71 extension_host_(host), | 71 extension_host_(host), |
| 72 close_bubble_factory_(this) { | 72 close_bubble_factory_(this) { |
| 73 inspect_with_devtools_ = show_action == SHOW_AND_INSPECT; | 73 inspect_with_devtools_ = show_action == SHOW_AND_INSPECT; |
| 74 // Adjust the margin so that contents fit better. | 74 // Adjust the margin so that contents fit better. |
| 75 const int margin = views::BubbleBorder::GetCornerRadius() / 2; | 75 const int margin = views::BubbleBorder::GetCornerRadius() / 2; |
| 76 set_margins(gfx::Insets(margin, margin, margin, margin)); | 76 set_margins(gfx::Insets(margin, margin, margin, margin)); |
| 77 SetLayoutManager(new views::FillLayout()); | 77 SetLayoutManager(new views::FillLayout()); |
| 78 AddChildView(host->view()); | 78 AddChildView(host->extension_view()); |
| 79 host->view()->SetContainer(this); | 79 host->extension_view()->SetContainer(this); |
| 80 // Use OnNativeFocusChange to check for child window activation on deactivate. | 80 // Use OnNativeFocusChange to check for child window activation on deactivate. |
| 81 set_close_on_deactivate(false); | 81 set_close_on_deactivate(false); |
| 82 // Make the bubble move with its anchor (during inspection, etc.). | 82 // Make the bubble move with its anchor (during inspection, etc.). |
| 83 set_move_with_anchor(true); | 83 set_move_with_anchor(true); |
| 84 | 84 |
| 85 // Wait to show the popup until the contained host finishes loading. | 85 // Wait to show the popup until the contained host finishes loading. |
| 86 registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 86 registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 87 content::Source<WebContents>(host->host_contents())); | 87 content::Source<WebContents>(host->host_contents())); |
| 88 | 88 |
| 89 // Listen for the containing view calling window.close(); | 89 // Listen for the containing view calling window.close(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if (inspect_with_devtools_) { | 216 if (inspect_with_devtools_) { |
| 217 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), | 217 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), |
| 218 true, | 218 true, |
| 219 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); | 219 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 void ExtensionPopup::CloseBubble() { | 223 void ExtensionPopup::CloseBubble() { |
| 224 GetWidget()->Close(); | 224 GetWidget()->Close(); |
| 225 } | 225 } |
| OLD | NEW |