| OLD | NEW |
| 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> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 - (void)parentWindowDidMove:(NSNotification*)notification { | 165 - (void)parentWindowDidMove:(NSNotification*)notification { |
| 166 DCHECK(bridge_); | 166 DCHECK(bridge_); |
| 167 [self setAnchorPoint:[self getExpectedAnchorPoint]]; | 167 [self setAnchorPoint:[self getExpectedAnchorPoint]]; |
| 168 } | 168 } |
| 169 | 169 |
| 170 - (void)show { | 170 - (void)show { |
| 171 chooserContentView_.reset([[ChooserContentViewCocoa alloc] | 171 chooserContentView_.reset([[ChooserContentViewCocoa alloc] |
| 172 initWithChooserTitle: | 172 initWithChooserTitle: |
| 173 l10n_util::GetNSStringF( | 173 l10n_util::GetNSStringF( |
| 174 IDS_CHOOSER_BUBBLE_PROMPT, | 174 IDS_DEVICE_CHOOSER_PROMPT, |
| 175 url_formatter::FormatOriginForSecurityDisplay( | 175 url_formatter::FormatOriginForSecurityDisplay( |
| 176 chooserController_->GetOrigin(), | 176 chooserController_->GetOrigin(), |
| 177 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC))]); | 177 url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC))]); |
| 178 | 178 |
| 179 tableView_ = [chooserContentView_ tableView]; | 179 tableView_ = [chooserContentView_ tableView]; |
| 180 connectButton_ = [chooserContentView_ connectButton]; | 180 connectButton_ = [chooserContentView_ connectButton]; |
| 181 cancelButton_ = [chooserContentView_ cancelButton]; | 181 cancelButton_ = [chooserContentView_ cancelButton]; |
| 182 helpButton_ = [chooserContentView_ helpButton]; | 182 helpButton_ = [chooserContentView_ helpButton]; |
| 183 | 183 |
| 184 [connectButton_ setTarget:self]; | 184 [connectButton_ setTarget:self]; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 static_cast<NSInteger>(1)); | 221 static_cast<NSInteger>(1)); |
| 222 } | 222 } |
| 223 | 223 |
| 224 - (id)tableView:(NSTableView*)tableView | 224 - (id)tableView:(NSTableView*)tableView |
| 225 objectValueForTableColumn:(NSTableColumn*)tableColumn | 225 objectValueForTableColumn:(NSTableColumn*)tableColumn |
| 226 row:(NSInteger)rowIndex { | 226 row:(NSInteger)rowIndex { |
| 227 NSInteger num_options = | 227 NSInteger num_options = |
| 228 static_cast<NSInteger>(chooserController_->NumOptions()); | 228 static_cast<NSInteger>(chooserController_->NumOptions()); |
| 229 if (num_options == 0) { | 229 if (num_options == 0) { |
| 230 DCHECK_EQ(0, rowIndex); | 230 DCHECK_EQ(0, rowIndex); |
| 231 return l10n_util::GetNSString(IDS_CHOOSER_BUBBLE_NO_DEVICES_FOUND_PROMPT); | 231 return l10n_util::GetNSString(IDS_DEVICE_CHOOSER_NO_DEVICES_FOUND_PROMPT); |
| 232 } | 232 } |
| 233 | 233 |
| 234 DCHECK_GE(rowIndex, 0); | 234 DCHECK_GE(rowIndex, 0); |
| 235 DCHECK_LT(rowIndex, num_options); | 235 DCHECK_LT(rowIndex, num_options); |
| 236 return base::SysUTF16ToNSString( | 236 return base::SysUTF16ToNSString( |
| 237 chooserController_->GetOption(static_cast<size_t>(rowIndex))); | 237 chooserController_->GetOption(static_cast<size_t>(rowIndex))); |
| 238 } | 238 } |
| 239 | 239 |
| 240 - (BOOL)tableView:(NSTableView*)aTableView | 240 - (BOOL)tableView:(NSTableView*)aTableView |
| 241 shouldEditTableColumn:(NSTableColumn*)aTableColumn | 241 shouldEditTableColumn:(NSTableColumn*)aTableColumn |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)]; | 395 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)]; |
| 396 } | 396 } |
| 397 | 397 |
| 398 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) { | 398 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) { |
| 399 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)]; | 399 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)]; |
| 400 } | 400 } |
| 401 | 401 |
| 402 void ChooserBubbleUiCocoa::OnBubbleClosing() { | 402 void ChooserBubbleUiCocoa::OnBubbleClosing() { |
| 403 chooser_bubble_ui_controller_ = nil; | 403 chooser_bubble_ui_controller_ = nil; |
| 404 } | 404 } |
| OLD | NEW |