| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chooser_dialog_cocoa_controller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #import "chrome/browser/ui/cocoa/chooser_content_view.h" | 9 #import "chrome/browser/ui/cocoa/chooser_content_view_cocoa.h" |
| 10 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h" | 10 #import "chrome/browser/ui/cocoa/extensions/chooser_dialog_cocoa.h" |
| 11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "components/chooser_controller/chooser_controller.h" | 12 #include "components/chooser_controller/chooser_controller.h" |
| 13 #include "components/url_formatter/elide_url.h" | 13 #include "components/url_formatter/elide_url.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 16 #import "ui/base/l10n/l10n_util_mac.h" | 16 #import "ui/base/l10n/l10n_util_mac.h" |
| 17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 18 #include "url/origin.h" | 18 #include "url/origin.h" |
| 19 | 19 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 41 GURL(origin.Serialize())); | 41 GURL(origin.Serialize())); |
| 42 if (extension) | 42 if (extension) |
| 43 chooserTitle = base::UTF8ToUTF16(extension->name()); | 43 chooserTitle = base::UTF8ToUTF16(extension->name()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 if (chooserTitle.empty()) { | 46 if (chooserTitle.empty()) { |
| 47 chooserTitle = url_formatter::FormatOriginForSecurityDisplay( | 47 chooserTitle = url_formatter::FormatOriginForSecurityDisplay( |
| 48 origin, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC); | 48 origin, url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC); |
| 49 } | 49 } |
| 50 | 50 |
| 51 chooserContentView_.reset([[ChooserContentView alloc] | 51 chooserContentView_.reset([[ChooserContentViewCocoa alloc] |
| 52 initWithChooserTitle:l10n_util::GetNSStringF(IDS_CHOOSER_BUBBLE_PROMPT, | 52 initWithChooserTitle:l10n_util::GetNSStringF(IDS_CHOOSER_BUBBLE_PROMPT, |
| 53 chooserTitle)]); | 53 chooserTitle)]); |
| 54 | 54 |
| 55 tableView_ = [chooserContentView_ tableView]; | 55 tableView_ = [chooserContentView_ tableView]; |
| 56 connectButton_ = [chooserContentView_ connectButton]; | 56 connectButton_ = [chooserContentView_ connectButton]; |
| 57 cancelButton_ = [chooserContentView_ cancelButton]; | 57 cancelButton_ = [chooserContentView_ cancelButton]; |
| 58 helpButton_ = [chooserContentView_ helpButton]; | 58 helpButton_ = [chooserContentView_ helpButton]; |
| 59 | 59 |
| 60 [connectButton_ setTarget:self]; | 60 [connectButton_ setTarget:self]; |
| 61 [connectButton_ setAction:@selector(onConnect:)]; | 61 [connectButton_ setAction:@selector(onConnect:)]; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 - (void)onCancel:(id)sender { | 142 - (void)onCancel:(id)sender { |
| 143 chooserDialogCocoa_->Dismissed(); | 143 chooserDialogCocoa_->Dismissed(); |
| 144 chooserController_->Cancel(); | 144 chooserController_->Cancel(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 - (void)onHelpPressed:(id)sender { | 147 - (void)onHelpPressed:(id)sender { |
| 148 chooserController_->OpenHelpCenterUrl(); | 148 chooserController_->OpenHelpCenterUrl(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 - (ChooserContentView*)chooserContentView { | 151 - (ChooserContentViewCocoa*)chooserContentView { |
| 152 return chooserContentView_.get(); | 152 return chooserContentView_.get(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 @end | 155 @end |
| OLD | NEW |