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

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

Issue 670463004: Make a platform-independent ToolbarActionViewController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 ExtensionPopupController* controller_; 141 ExtensionPopupController* controller_;
142 // WebContents for controller. Hold onto this separately because we need to 142 // WebContents for controller. Hold onto this separately because we need to
143 // know what it is for notifications, but our ExtensionViewHost may not be 143 // know what it is for notifications, but our ExtensionViewHost may not be
144 // valid. 144 // valid.
145 WebContents* web_contents_; 145 WebContents* web_contents_;
146 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; 146 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_;
147 }; 147 };
148 148
149 @implementation ExtensionPopupController 149 @implementation ExtensionPopupController
150 150
151 @synthesize extensionId = extensionId_;
152
151 - (id)initWithHost:(extensions::ExtensionViewHost*)host 153 - (id)initWithHost:(extensions::ExtensionViewHost*)host
152 parentWindow:(NSWindow*)parentWindow 154 parentWindow:(NSWindow*)parentWindow
153 anchoredAt:(NSPoint)anchoredAt 155 anchoredAt:(NSPoint)anchoredAt
154 arrowLocation:(info_bubble::BubbleArrowLocation)arrowLocation 156 arrowLocation:(info_bubble::BubbleArrowLocation)arrowLocation
155 devMode:(BOOL)devMode { 157 devMode:(BOOL)devMode {
156 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] 158 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc]
157 initWithContentRect:ui::kWindowSizeDeterminedLater 159 initWithContentRect:ui::kWindowSizeDeterminedLater
158 styleMask:NSBorderlessWindowMask 160 styleMask:NSBorderlessWindowMask
159 backing:NSBackingStoreBuffered 161 backing:NSBackingStoreBuffered
160 defer:YES]); 162 defer:YES]);
161 if (!window.get()) 163 if (!window.get())
162 return nil; 164 return nil;
163 165
164 anchoredAt = [parentWindow convertBaseToScreen:anchoredAt]; 166 anchoredAt = [parentWindow convertBaseToScreen:anchoredAt];
165 if ((self = [super initWithWindow:window 167 if ((self = [super initWithWindow:window
166 parentWindow:parentWindow 168 parentWindow:parentWindow
167 anchoredAt:anchoredAt])) { 169 anchoredAt:anchoredAt])) {
168 host_.reset(host); 170 host_.reset(host);
171 extensionId_ = host_->extension_id();
169 beingInspected_ = devMode; 172 beingInspected_ = devMode;
170 ignoreWindowDidResignKey_ = NO; 173 ignoreWindowDidResignKey_ = NO;
171 174
172 InfoBubbleView* view = self.bubble; 175 InfoBubbleView* view = self.bubble;
173 [view setArrowLocation:arrowLocation]; 176 [view setArrowLocation:arrowLocation];
174 177
175 extensionView_ = host->view()->GetNativeView(); 178 extensionView_ = host->view()->GetNativeView();
176 container_.reset(new ExtensionPopupContainer(self)); 179 container_.reset(new ExtensionPopupContainer(self));
177 static_cast<ExtensionViewMac*>(host->view()) 180 static_cast<ExtensionViewMac*>(host->view())
178 ->set_container(container_.get()); 181 ->set_container(container_.get());
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return minSize; 435 return minSize;
433 } 436 }
434 437
435 // Private (TestingAPI) 438 // Private (TestingAPI)
436 + (NSSize)maxPopupSize { 439 + (NSSize)maxPopupSize {
437 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; 440 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight};
438 return maxSize; 441 return maxSize;
439 } 442 }
440 443
441 @end 444 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698