Chromium Code Reviews| 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 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" | 5 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/net/referrer.h" | 8 #include "chrome/browser/net/referrer.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" | 10 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 BluetoothChooserController::BluetoothChooserController( | 29 BluetoothChooserController::BluetoothChooserController( |
| 30 content::RenderFrameHost* owner, | 30 content::RenderFrameHost* owner, |
| 31 const content::BluetoothChooser::EventHandler& event_handler) | 31 const content::BluetoothChooser::EventHandler& event_handler) |
| 32 : ChooserController(owner), event_handler_(event_handler) {} | 32 : ChooserController(owner), event_handler_(event_handler) {} |
| 33 | 33 |
| 34 BluetoothChooserController::~BluetoothChooserController() {} | 34 BluetoothChooserController::~BluetoothChooserController() {} |
| 35 | 35 |
| 36 base::string16 BluetoothChooserController::GetTitle() const { | |
| 37 std::pair<base::string16, bool> title_prefix = GetTitlePrefix(); | |
|
scheib
2016/07/13 18:14:07
BTW, if you were using a tuple to be returned you
| |
| 38 return l10n_util::GetStringFUTF16( | |
| 39 title_prefix.second ? IDS_BLUETOOTH_DEVICE_CHOOSER_PROMPT_ORIGIN | |
| 40 : IDS_BLUETOOTH_DEVICE_CHOOSER_PROMPT_EXTENSION_NAME, | |
| 41 title_prefix.first); | |
| 42 } | |
| 43 | |
| 36 base::string16 BluetoothChooserController::GetOkButtonLabel() const { | 44 base::string16 BluetoothChooserController::GetOkButtonLabel() const { |
| 37 return l10n_util::GetStringUTF16( | 45 return l10n_util::GetStringUTF16( |
| 38 IDS_BLUETOOTH_DEVICE_CHOOSER_PAIR_BUTTON_TEXT); | 46 IDS_BLUETOOTH_DEVICE_CHOOSER_PAIR_BUTTON_TEXT); |
| 39 } | 47 } |
| 40 | 48 |
| 41 size_t BluetoothChooserController::NumOptions() const { | 49 size_t BluetoothChooserController::NumOptions() const { |
| 42 return device_names_and_ids_.size(); | 50 return device_names_and_ids_.size(); |
| 43 } | 51 } |
| 44 | 52 |
| 45 base::string16 BluetoothChooserController::GetOption(size_t index) const { | 53 base::string16 BluetoothChooserController::GetOption(size_t index) const { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 DCHECK_GT(device_name_map_[it->first], 0); | 101 DCHECK_GT(device_name_map_[it->first], 0); |
| 94 if (--device_name_map_[it->first] == 0) | 102 if (--device_name_map_[it->first] == 0) |
| 95 device_name_map_.erase(it->first); | 103 device_name_map_.erase(it->first); |
| 96 device_names_and_ids_.erase(it); | 104 device_names_and_ids_.erase(it); |
| 97 if (observer()) | 105 if (observer()) |
| 98 observer()->OnOptionRemoved(index); | 106 observer()->OnOptionRemoved(index); |
| 99 return; | 107 return; |
| 100 } | 108 } |
| 101 } | 109 } |
| 102 } | 110 } |
| OLD | NEW |