| 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 11 matching lines...) Expand all Loading... |
| 22 ProfileManager::GetActiveUserProfile()); | 22 ProfileManager::GetActiveUserProfile()); |
| 23 DCHECK(browser_displayer.browser()); | 23 DCHECK(browser_displayer.browser()); |
| 24 return browser_displayer.browser(); | 24 return browser_displayer.browser(); |
| 25 } | 25 } |
| 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, |
| 33 IDS_BLUETOOTH_DEVICE_CHOOSER_PROMPT_ORIGIN, |
| 34 IDS_BLUETOOTH_DEVICE_CHOOSER_PROMPT_EXTENSION_NAME), |
| 35 event_handler_(event_handler) {} |
| 33 | 36 |
| 34 BluetoothChooserController::~BluetoothChooserController() {} | 37 BluetoothChooserController::~BluetoothChooserController() {} |
| 35 | 38 |
| 36 base::string16 BluetoothChooserController::GetOkButtonLabel() const { | 39 base::string16 BluetoothChooserController::GetOkButtonLabel() const { |
| 37 return l10n_util::GetStringUTF16( | 40 return l10n_util::GetStringUTF16( |
| 38 IDS_BLUETOOTH_DEVICE_CHOOSER_PAIR_BUTTON_TEXT); | 41 IDS_BLUETOOTH_DEVICE_CHOOSER_PAIR_BUTTON_TEXT); |
| 39 } | 42 } |
| 40 | 43 |
| 41 size_t BluetoothChooserController::NumOptions() const { | 44 size_t BluetoothChooserController::NumOptions() const { |
| 42 return device_names_and_ids_.size(); | 45 return device_names_and_ids_.size(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 DCHECK_GT(device_name_map_[it->first], 0); | 96 DCHECK_GT(device_name_map_[it->first], 0); |
| 94 if (--device_name_map_[it->first] == 0) | 97 if (--device_name_map_[it->first] == 0) |
| 95 device_name_map_.erase(it->first); | 98 device_name_map_.erase(it->first); |
| 96 device_names_and_ids_.erase(it); | 99 device_names_and_ids_.erase(it); |
| 97 if (observer()) | 100 if (observer()) |
| 98 observer()->OnOptionRemoved(index); | 101 observer()->OnOptionRemoved(index); |
| 99 return; | 102 return; |
| 100 } | 103 } |
| 101 } | 104 } |
| 102 } | 105 } |
| OLD | NEW |