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

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

Issue 2555033003: Add ScopedMacRTL class for Cocoa browser RTL testing (Closed)
Patch Set: Add to deps AFTER deps exists Created 4 years 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/base_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "base/mac/sdk_forward_declarations.h" 12 #include "base/mac/sdk_forward_declarations.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 14 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
15 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 15 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 16 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
17 #include "chrome/browser/ui/cocoa/l10n_util.h" 17 #import "ui/base/cocoa/rtl_util.h"
18 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" 18 #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h"
19 #include "components/bubble/bubble_controller.h" 19 #include "components/bubble/bubble_controller.h"
20 #include "ui/base/cocoa/cocoa_base_utils.h" 20 #include "ui/base/cocoa/cocoa_base_utils.h"
21 21
22 @interface BaseBubbleController (Private) 22 @interface BaseBubbleController (Private)
23 - (void)registerForNotifications; 23 - (void)registerForNotifications;
24 - (void)updateOriginFromAnchor; 24 - (void)updateOriginFromAnchor;
25 - (void)activateTabWithContents:(content::WebContents*)newContents 25 - (void)activateTabWithContents:(content::WebContents*)newContents
26 previousContents:(content::WebContents*)oldContents 26 previousContents:(content::WebContents*)oldContents
27 atIndex:(NSInteger)index 27 atIndex:(NSInteger)index
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // This is not a "real" cancel as potential changes to the radio group are not 397 // This is not a "real" cancel as potential changes to the radio group are not
398 // undone. That's ok. 398 // undone. That's ok.
399 [self closeBubbleWithReason:BUBBLE_CLOSE_CANCELED]; 399 [self closeBubbleWithReason:BUBBLE_CLOSE_CANCELED];
400 } 400 }
401 401
402 // Takes the |anchor_| point and adjusts the window's origin accordingly. 402 // Takes the |anchor_| point and adjusts the window's origin accordingly.
403 - (void)updateOriginFromAnchor { 403 - (void)updateOriginFromAnchor {
404 NSWindow* window = [self window]; 404 NSWindow* window = [self window];
405 NSPoint origin = anchor_; 405 NSPoint origin = anchor_;
406 406
407 BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout(); 407 BOOL isRTL = cocoa_rtl_util::ShouldDoExperimentalRTLLayout();
408 switch ([bubble_ alignment]) { 408 switch ([bubble_ alignment]) {
409 case info_bubble::kAlignArrowToAnchor: { 409 case info_bubble::kAlignArrowToAnchor: {
410 NSSize offsets = NSMakeSize(info_bubble::kBubbleArrowXOffset + 410 NSSize offsets = NSMakeSize(info_bubble::kBubbleArrowXOffset +
411 info_bubble::kBubbleArrowWidth / 2.0, 0); 411 info_bubble::kBubbleArrowWidth / 2.0, 0);
412 offsets = [[parentWindow_ contentView] convertSize:offsets toView:nil]; 412 offsets = [[parentWindow_ contentView] convertSize:offsets toView:nil];
413 switch ([bubble_ arrowLocation]) { 413 switch ([bubble_ arrowLocation]) {
414 case info_bubble::kTopRight: 414 case info_bubble::kTopRight:
415 origin.x -= NSWidth([window frame]) - offsets.width; 415 origin.x -= NSWidth([window frame]) - offsets.width;
416 break; 416 break;
417 case info_bubble::kTopLeft: 417 case info_bubble::kTopLeft:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 456
457 - (void)activateTabWithContents:(content::WebContents*)newContents 457 - (void)activateTabWithContents:(content::WebContents*)newContents
458 previousContents:(content::WebContents*)oldContents 458 previousContents:(content::WebContents*)oldContents
459 atIndex:(NSInteger)index 459 atIndex:(NSInteger)index
460 reason:(int)reason { 460 reason:(int)reason {
461 // The user switched tabs; close. 461 // The user switched tabs; close.
462 [self closeBubble]; 462 [self closeBubble];
463 } 463 }
464 464
465 @end // BaseBubbleController 465 @end // BaseBubbleController
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | ui/base/cocoa/rtl_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698