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

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

Issue 1906253002: Display origin url on the chooser permission dialog title on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: display origin url on the chooser permission dialog title on Mac Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.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 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #import "chrome/browser/ui/chrome_style.h" 19 #import "chrome/browser/ui/chrome_style.h"
20 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" 20 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
21 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 21 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
22 #import "chrome/browser/ui/cocoa/browser_window_utils.h" 22 #import "chrome/browser/ui/cocoa/browser_window_utils.h"
23 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" 23 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h"
24 #import "chrome/browser/ui/cocoa/hover_close_button.h" 24 #import "chrome/browser/ui/cocoa/hover_close_button.h"
25 #import "chrome/browser/ui/cocoa/info_bubble_view.h" 25 #import "chrome/browser/ui/cocoa/info_bubble_view.h"
26 #import "chrome/browser/ui/cocoa/info_bubble_window.h" 26 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
27 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 27 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
28 #include "chrome/grit/generated_resources.h" 28 #include "chrome/grit/generated_resources.h"
29 #include "content/public/browser/native_web_keyboard_event.h" 29 #include "content/public/browser/native_web_keyboard_event.h"
30 #include "skia/ext/skia_utils_mac.h" 30 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw eaker.h"
31 #include "ui/base/cocoa/cocoa_base_utils.h" 31 #include "ui/base/cocoa/cocoa_base_utils.h"
32 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" 32 #import "ui/base/cocoa/controls/hyperlink_button_cell.h"
33 #include "ui/base/cocoa/window_size_constants.h" 33 #include "ui/base/cocoa/window_size_constants.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/l10n/l10n_util_mac.h" 35 #include "ui/base/l10n/l10n_util_mac.h"
36 #include "url/gurl.h" 36 #include "url/gurl.h"
37 #include "url/origin.h"
37 38
38 namespace { 39 namespace {
39 40
40 // Chooser bubble width. 41 // Chooser bubble width.
41 const CGFloat kChooserBubbleWidth = 320.0f; 42 const CGFloat kChooserBubbleWidth = 320.0f;
42 43
43 // Chooser bubble height. 44 // Chooser bubble height.
44 const CGFloat kChooserBubbleHeight = 280.0f; 45 const CGFloat kChooserBubbleHeight = 280.0f;
45 46
46 // Distance between the bubble border and the view that is closest to the 47 // Distance between the bubble border and the view that is closest to the
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 return browser_->window()->GetNativeWindow(); 447 return browser_->window()->GetNativeWindow();
447 } 448 }
448 449
449 - (base::scoped_nsobject<NSTextField>)bubbleTitle { 450 - (base::scoped_nsobject<NSTextField>)bubbleTitle {
450 base::scoped_nsobject<NSTextField> titleView( 451 base::scoped_nsobject<NSTextField> titleView(
451 [[NSTextField alloc] initWithFrame:NSZeroRect]); 452 [[NSTextField alloc] initWithFrame:NSZeroRect]);
452 [titleView setDrawsBackground:NO]; 453 [titleView setDrawsBackground:NO];
453 [titleView setBezeled:NO]; 454 [titleView setBezeled:NO];
454 [titleView setEditable:NO]; 455 [titleView setEditable:NO];
455 [titleView setSelectable:NO]; 456 [titleView setSelectable:NO];
456 [titleView setStringValue:l10n_util::GetNSString(IDS_CHOOSER_BUBBLE_PROMPT)]; 457 [titleView setStringValue:l10n_util::GetNSStringF(
458 IDS_CHOOSER_BUBBLE_PROMPT,
459 base::ASCIIToUTF16(
460 chooserBubbleController_->GetOrigin()
461 .Serialize()))];
457 [titleView setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; 462 [titleView setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
458 [titleView sizeToFit]; 463 // The height is arbitrary as it will be adjusted later.
464 [titleView setFrameSize:NSMakeSize(kChooserBubbleWidth - 2 * kMarginX, 0.0f)];
465 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:titleView];
459 return titleView; 466 return titleView;
460 } 467 }
461 468
462 - (base::scoped_nsobject<NSButton>)buttonWithTitle:(NSString*)title 469 - (base::scoped_nsobject<NSButton>)buttonWithTitle:(NSString*)title
463 action:(SEL)action { 470 action:(SEL)action {
464 base::scoped_nsobject<NSButton> button( 471 base::scoped_nsobject<NSButton> button(
465 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]); 472 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]);
466 [button setButtonType:NSMomentaryPushInButton]; 473 [button setButtonType:NSMomentaryPushInButton];
467 [button setTitle:title]; 474 [button setTitle:title];
468 [button setTarget:self]; 475 [button setTarget:self];
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)]; 600 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)];
594 } 601 }
595 602
596 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) { 603 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) {
597 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)]; 604 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)];
598 } 605 }
599 606
600 void ChooserBubbleUiCocoa::OnBubbleClosing() { 607 void ChooserBubbleUiCocoa::OnBubbleClosing() {
601 chooser_bubble_ui_controller_ = nil; 608 chooser_bubble_ui_controller_ = nil;
602 } 609 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698