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

Side by Side Diff: chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm

Issue 10885024: Integrate Chrome To Mobile with Action Box UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable ShowChromeToMobileBubble on GTK. Created 8 years, 3 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/chrome_to_mobile_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/chrome_to_mobile_service_factory.h" 10 #include "chrome/browser/chrome_to_mobile_service_factory.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 NSRect windowFrame = [window frame]; 139 NSRect windowFrame = [window frame];
140 windowFrame.size.height += deltaY; 140 windowFrame.size.height += deltaY;
141 [window setFrame:windowFrame display:YES animate:NO]; 141 [window setFrame:windowFrame display:YES animate:NO];
142 } 142 }
143 143
144 // Get the anchor point for the bubble in screen coordinates. 144 // Get the anchor point for the bubble in screen coordinates.
145 BrowserWindowController* controller = [BrowserWindowController 145 BrowserWindowController* controller = [BrowserWindowController
146 browserWindowControllerForWindow:self.parentWindow]; 146 browserWindowControllerForWindow:self.parentWindow];
147 if (controller != nil) { 147 if (controller != nil) {
148 LocationBarViewMac* locationBar = [controller locationBarBridge]; 148 LocationBarViewMac* locationBar = [controller locationBarBridge];
149 NSPoint bubblePoint; 149 NSPoint bubblePoint = locationBar->GetActionBoxAnchorPoint();
150 if (extensions::switch_utils::IsExtensionsInActionBoxEnabled()) { 150 bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint];
151 bubblePoint = locationBar->GetActionBoxAnchorPoint(); 151 // Without an arrow, the anchor point of a bubble is the top left corner,
152 bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint]; 152 // but GetActionBoxAnchorPoint returns the top right corner.
153 // Without an arrow, the anchor point of a bubble is the top left corner, 153 bubblePoint.x -= self.bubble.frame.size.width;
154 // but GetActionBoxAnchorPoint returns the top right corner. 154 [self.bubble setArrowLocation:info_bubble::kNoArrow];
155 bubblePoint.x -= self.bubble.frame.size.width; 155 [self.bubble setCornerFlags:info_bubble::kRoundedBottomCorners];
156 [self.bubble setArrowLocation:info_bubble::kNoArrow]; 156 [self.bubble setAlignment:info_bubble::kAlignEdgeToAnchorEdge];
157 [self.bubble setCornerFlags:info_bubble::kRoundedBottomCorners]; 157 [window setContentSize:self.bubble.frame.size];
158 [self.bubble setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; 158 [window setContentView:self.bubble];
159 [window setContentSize:self.bubble.frame.size];
160 [window setContentView:self.bubble];
161 } else {
162 bubblePoint = locationBar->GetChromeToMobileBubblePoint();
163 bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint];
164 [self.bubble setArrowLocation:info_bubble::kTopRight];
165 }
166 [self setAnchorPoint:bubblePoint]; 159 [self setAnchorPoint:bubblePoint];
167 } 160 }
168 161
169 // Initialize the checkbox to send an offline copy. 162 // Initialize the checkbox to send an offline copy.
170 NSString* sendCopyString = 163 NSString* sendCopyString =
171 l10n_util::GetNSStringF(IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY, 164 l10n_util::GetNSStringF(IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY,
172 l10n_util::GetStringUTF16( 165 l10n_util::GetStringUTF16(
173 IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY_GENERATING)); 166 IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY_GENERATING));
174 [sendCopy_ setTitle:sendCopyString]; 167 [sendCopy_ setTitle:sendCopyString];
175 [sendCopy_ setState:NSOffState]; 168 [sendCopy_ setState:NSOffState];
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 293
301 - (void)setSendCopy:(bool)sendCopy { 294 - (void)setSendCopy:(bool)sendCopy {
302 [sendCopy_ setState:(sendCopy ? NSOnState : NSOffState)]; 295 [sendCopy_ setState:(sendCopy ? NSOnState : NSOffState)];
303 } 296 }
304 297
305 - (ChromeToMobileBubbleNotificationBridge*)bridge { 298 - (ChromeToMobileBubbleNotificationBridge*)bridge {
306 return bridge_.get(); 299 return bridge_.get();
307 } 300 }
308 301
309 @end // ChromeToMobileBubbleController (JustForTesting) 302 @end // ChromeToMobileBubbleController (JustForTesting)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698