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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Fix null-window error. Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/website_settings/chooser_bubble_ui_cocoa.h" 5 #import "chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
11 11
12 #include "base/mac/scoped_nsobject.h" 12 #include "base/mac/scoped_nsobject.h"
13 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_finder.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
18 #import "chrome/browser/ui/chrome_style.h" 18 #import "chrome/browser/ui/chrome_style.h"
19 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" 19 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
20 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 20 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
21 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 21 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
22 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" 22 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
23 #import "chrome/browser/ui/cocoa/hover_close_button.h" 23 #import "chrome/browser/ui/cocoa/hover_close_button.h"
24 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 24 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
25 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 25 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
26 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 26 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
27 #include "chrome/grit/generated_resources.h" 27 #include "chrome/grit/generated_resources.h"
28 #include "content/public/browser/native_web_keyboard_event.h" 28 #include "content/public/browser/native_web_keyboard_event.h"
29 #include "skia/ext/skia_utils_mac.h" 29 #include "skia/ext/skia_utils_mac.h"
30 #include "ui/base/cocoa/cocoa_base_utils.h"
30 #include "ui/base/cocoa/controls/hyperlink_text_view.h" 31 #include "ui/base/cocoa/controls/hyperlink_text_view.h"
31 #include "ui/base/cocoa/window_size_constants.h" 32 #include "ui/base/cocoa/window_size_constants.h"
32 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/l10n/l10n_util_mac.h" 34 #include "ui/base/l10n/l10n_util_mac.h"
34 #include "url/gurl.h" 35 #include "url/gurl.h"
35 36
36 namespace { 37 namespace {
37 38
38 // Chooser bubble width. 39 // Chooser bubble width.
39 const CGFloat kChooserBubbleWidth = 320.0f; 40 const CGFloat kChooserBubbleWidth = 320.0f;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if ([self hasLocationBar]) { 401 if ([self hasLocationBar]) {
401 LocationBarViewMac* locationBar = 402 LocationBarViewMac* locationBar =
402 [[[self getExpectedParentWindow] windowController] locationBarBridge]; 403 [[[self getExpectedParentWindow] windowController] locationBarBridge];
403 anchor = locationBar->GetPageInfoBubblePoint(); 404 anchor = locationBar->GetPageInfoBubblePoint();
404 } else { 405 } else {
405 // Center the bubble if there's no location bar. 406 // Center the bubble if there's no location bar.
406 NSRect contentFrame = [[[self getExpectedParentWindow] contentView] frame]; 407 NSRect contentFrame = [[[self getExpectedParentWindow] contentView] frame];
407 anchor = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame)); 408 anchor = NSMakePoint(NSMidX(contentFrame), NSMaxY(contentFrame));
408 } 409 }
409 410
410 return [[self getExpectedParentWindow] convertBaseToScreen:anchor]; 411 return ui::ConvertPointFromWindowToScreen([self getExpectedParentWindow],
412 anchor);
411 } 413 }
412 414
413 - (bool)hasLocationBar { 415 - (bool)hasLocationBar {
414 return browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); 416 return browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
415 } 417 }
416 418
417 - (info_bubble::BubbleArrowLocation)getExpectedArrowLocation { 419 - (info_bubble::BubbleArrowLocation)getExpectedArrowLocation {
418 return [self hasLocationBar] ? info_bubble::kTopLeft : info_bubble::kNoArrow; 420 return [self hasLocationBar] ? info_bubble::kTopLeft : info_bubble::kNoArrow;
419 } 421 }
420 422
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)]; 576 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)];
575 } 577 }
576 578
577 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) { 579 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) {
578 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)]; 580 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)];
579 } 581 }
580 582
581 void ChooserBubbleUiCocoa::OnBubbleClosing() { 583 void ChooserBubbleUiCocoa::OnBubbleClosing() {
582 chooser_bubble_ui_controller_ = nil; 584 chooser_bubble_ui_controller_ = nil;
583 } 585 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698