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

Unified Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc

Issue 1724183005: Change ChooserBubbleDelegate class name to ChooserBubbleController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merged changes from master, resolved conflicts and updated related files Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc
diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc b/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc
deleted file mode 100644
index 10ad62bb15e95eb242be6a25818efbe48a1e8911..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.h"
-
-#include "base/stl_util.h"
-#include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h"
-#include "chrome/common/url_constants.h"
-#include "components/bubble/bubble_controller.h"
-#include "url/gurl.h"
-
-BluetoothChooserBubbleDelegate::BluetoothChooserBubbleDelegate(
- content::RenderFrameHost* owner)
- : ChooserBubbleDelegate(owner), bluetooth_chooser_(nullptr) {}
-
-BluetoothChooserBubbleDelegate::~BluetoothChooserBubbleDelegate() {
- if (bluetooth_chooser_)
- bluetooth_chooser_->set_bluetooth_chooser_bubble_delegate(nullptr);
-}
-
-size_t BluetoothChooserBubbleDelegate::NumOptions() const {
- return device_names_and_ids_.size();
-}
-
-const base::string16& BluetoothChooserBubbleDelegate::GetOption(
- size_t index) const {
- DCHECK_LT(index, device_names_and_ids_.size());
- return device_names_and_ids_[index].first;
-}
-
-void BluetoothChooserBubbleDelegate::Select(size_t index) {
- DCHECK_LT(index, device_names_and_ids_.size());
- if (bluetooth_chooser_) {
- bluetooth_chooser_->CallEventHandler(
- content::BluetoothChooser::Event::SELECTED,
- device_names_and_ids_[index].second);
- }
-
- if (bubble_controller_)
- bubble_controller_->CloseBubble(BUBBLE_CLOSE_ACCEPTED);
-}
-
-void BluetoothChooserBubbleDelegate::Cancel() {
- if (bluetooth_chooser_) {
- bluetooth_chooser_->CallEventHandler(
- content::BluetoothChooser::Event::CANCELLED, std::string());
- }
-
- if (bubble_controller_)
- bubble_controller_->CloseBubble(BUBBLE_CLOSE_CANCELED);
-}
-
-void BluetoothChooserBubbleDelegate::Close() {
- if (bluetooth_chooser_) {
- bluetooth_chooser_->CallEventHandler(
- content::BluetoothChooser::Event::CANCELLED, std::string());
- }
-}
-
-GURL BluetoothChooserBubbleDelegate::GetHelpCenterUrl() const {
- return GURL(chrome::kChooserBluetoothOverviewURL);
-}
-
-void BluetoothChooserBubbleDelegate::AddDevice(
- const std::string& device_id,
- const base::string16& device_name) {
- device_names_and_ids_.push_back(std::make_pair(device_name, device_id));
- if (observer())
- observer()->OnOptionAdded(device_names_and_ids_.size() - 1);
-}
-
-void BluetoothChooserBubbleDelegate::RemoveDevice(
- const std::string& device_id) {
- for (auto it = device_names_and_ids_.begin();
- it != device_names_and_ids_.end(); ++it) {
- if (it->second == device_id) {
- size_t index = it - device_names_and_ids_.begin();
- device_names_and_ids_.erase(it);
- if (observer())
- observer()->OnOptionRemoved(index);
- return;
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698