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

Side by Side Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc

Issue 1661063002: Add message and Help Center link to the chooser UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added GetOptionDescription virtual function to ChooserBubbleDelegate 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 unified diff | Download patch
OLDNEW
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_bubble_delegate.h" 5 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" 9 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h"
10 #include "chrome/common/url_constants.h"
9 #include "components/bubble/bubble_controller.h" 11 #include "components/bubble/bubble_controller.h"
10 12
11 BluetoothChooserBubbleDelegate::BluetoothChooserBubbleDelegate( 13 BluetoothChooserBubbleDelegate::BluetoothChooserBubbleDelegate(
12 content::RenderFrameHost* owner) 14 content::RenderFrameHost* owner)
13 : ChooserBubbleDelegate(owner), bluetooth_chooser_(nullptr) {} 15 : ChooserBubbleDelegate(owner), bluetooth_chooser_(nullptr) {}
14 16
15 BluetoothChooserBubbleDelegate::~BluetoothChooserBubbleDelegate() { 17 BluetoothChooserBubbleDelegate::~BluetoothChooserBubbleDelegate() {
16 if (bluetooth_chooser_) 18 if (bluetooth_chooser_)
17 bluetooth_chooser_->set_bluetooth_chooser_bubble_delegate(nullptr); 19 bluetooth_chooser_->set_bluetooth_chooser_bubble_delegate(nullptr);
18 } 20 }
(...skipping 30 matching lines...) Expand all
49 bubble_controller_->CloseBubble(BUBBLE_CLOSE_CANCELED); 51 bubble_controller_->CloseBubble(BUBBLE_CLOSE_CANCELED);
50 } 52 }
51 53
52 void BluetoothChooserBubbleDelegate::Close() { 54 void BluetoothChooserBubbleDelegate::Close() {
53 if (bluetooth_chooser_) { 55 if (bluetooth_chooser_) {
54 bluetooth_chooser_->CallEventHandler( 56 bluetooth_chooser_->CallEventHandler(
55 content::BluetoothChooser::Event::CANCELLED, std::string()); 57 content::BluetoothChooser::Event::CANCELLED, std::string());
56 } 58 }
57 } 59 }
58 60
61 base::string16 BluetoothChooserBubbleDelegate::GetHelpCenterUrl() const {
62 return base::ASCIIToUTF16(chrome::kChooserBluetoothOverviewURL);
63 }
64
65 base::string16 BluetoothChooserBubbleDelegate::GetOptionDescription() const {
66 return base::ASCIIToUTF16("device");
Jeffrey Yasskin 2016/02/19 21:25:40 This needs to be translated.
juncai 2016/02/20 02:25:05 Removed this member function since it is not neede
67 }
68
59 void BluetoothChooserBubbleDelegate::AddDevice( 69 void BluetoothChooserBubbleDelegate::AddDevice(
60 const std::string& device_id, 70 const std::string& device_id,
61 const base::string16& device_name) { 71 const base::string16& device_name) {
62 device_names_and_ids_.push_back(std::make_pair(device_name, device_id)); 72 device_names_and_ids_.push_back(std::make_pair(device_name, device_id));
63 if (observer()) 73 if (observer())
64 observer()->OnOptionAdded(device_names_and_ids_.size() - 1); 74 observer()->OnOptionAdded(device_names_and_ids_.size() - 1);
65 } 75 }
66 76
67 void BluetoothChooserBubbleDelegate::RemoveDevice( 77 void BluetoothChooserBubbleDelegate::RemoveDevice(
68 const std::string& device_id) { 78 const std::string& device_id) {
69 for (auto it = device_names_and_ids_.begin(); 79 for (auto it = device_names_and_ids_.begin();
70 it != device_names_and_ids_.end(); ++it) { 80 it != device_names_and_ids_.end(); ++it) {
71 if (it->second == device_id) { 81 if (it->second == device_id) {
72 size_t index = it - device_names_and_ids_.begin(); 82 size_t index = it - device_names_and_ids_.begin();
73 device_names_and_ids_.erase(it); 83 device_names_and_ids_.erase(it);
74 if (observer()) 84 if (observer())
75 observer()->OnOptionRemoved(index); 85 observer()->OnOptionRemoved(index);
76 return; 86 return;
77 } 87 }
78 } 88 }
79 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698