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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm

Issue 449043002: [DevTools] Make DevTools clients talk directly to DevToolsAgentHost instead of using DevToolsManage… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 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 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/devtools/devtools_window.h" 11 #include "chrome/browser/devtools/devtools_window.h"
12 #include "chrome/browser/extensions/extension_view_host.h" 12 #include "chrome/browser/extensions/extension_view_host.h"
13 #include "chrome/browser/extensions/extension_view_host_factory.h" 13 #include "chrome/browser/extensions/extension_view_host_factory.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
18 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" 18 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
19 #import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" 19 #import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
20 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 20 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
21 #include "components/web_modal/popup_manager.h" 21 #include "components/web_modal/popup_manager.h"
22 #include "content/public/browser/devtools_agent_host.h" 22 #include "content/public/browser/devtools_agent_host.h"
23 #include "content/public/browser/devtools_manager.h"
24 #include "content/public/browser/notification_details.h" 23 #include "content/public/browser/notification_details.h"
25 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
26 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
27 #include "ui/base/cocoa/window_size_constants.h" 26 #include "ui/base/cocoa/window_size_constants.h"
28 27
29 using content::BrowserContext; 28 using content::BrowserContext;
30 using content::RenderViewHost; 29 using content::RenderViewHost;
31 30
32 namespace { 31 namespace {
33 // The duration for any animations that might be invoked by this controller. 32 // The duration for any animations that might be invoked by this controller.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 }; 88 };
90 89
91 class DevtoolsNotificationBridge : public content::NotificationObserver { 90 class DevtoolsNotificationBridge : public content::NotificationObserver {
92 public: 91 public:
93 explicit DevtoolsNotificationBridge(ExtensionPopupController* controller) 92 explicit DevtoolsNotificationBridge(ExtensionPopupController* controller)
94 : controller_(controller), 93 : controller_(controller),
95 render_view_host_([controller_ extensionViewHost]->render_view_host()), 94 render_view_host_([controller_ extensionViewHost]->render_view_host()),
96 devtools_callback_(base::Bind( 95 devtools_callback_(base::Bind(
97 &DevtoolsNotificationBridge::OnDevToolsStateChanged, 96 &DevtoolsNotificationBridge::OnDevToolsStateChanged,
98 base::Unretained(this))) { 97 base::Unretained(this))) {
99 content::DevToolsManager::GetInstance()->AddAgentStateCallback( 98 content::DevToolsAgentHost::AddAgentStateCallback(devtools_callback_);
100 devtools_callback_);
101 } 99 }
102 100
103 virtual ~DevtoolsNotificationBridge() { 101 virtual ~DevtoolsNotificationBridge() {
104 content::DevToolsManager::GetInstance()->RemoveAgentStateCallback( 102 content::DevToolsAgentHost::RemoveAgentStateCallback(devtools_callback_);
105 devtools_callback_);
106 } 103 }
107 104
108 void OnDevToolsStateChanged(content::DevToolsAgentHost* agent_host, 105 void OnDevToolsStateChanged(content::DevToolsAgentHost* agent_host,
109 bool attached) { 106 bool attached) {
110 if (agent_host->GetRenderViewHost() != render_view_host_) 107 if (agent_host->GetRenderViewHost() != render_view_host_)
111 return; 108 return;
112 109
113 if (attached) { 110 if (attached) {
114 // Set the flag on the controller so the popup is not hidden when 111 // Set the flag on the controller so the popup is not hidden when
115 // the dev tools get focus. 112 // the dev tools get focus.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 return minSize; 428 return minSize;
432 } 429 }
433 430
434 // Private (TestingAPI) 431 // Private (TestingAPI)
435 + (NSSize)maxPopupSize { 432 + (NSSize)maxPopupSize {
436 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; 433 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight};
437 return maxSize; 434 return maxSize;
438 } 435 }
439 436
440 @end 437 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698