diff options
| author | juncai <juncai@chromium.org> | 2016-02-26 13:56:55 -0800 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-02-26 21:58:34 +0000 |
| commit | a2ad62074ea877b0440571c074fe49352e49aa4f (patch) | |
| tree | 77d8766844e5b9b99fa4bf41119a7258b2acfb26 /chrome/browser/ui/bluetooth | |
| parent | 83a7f26e6402938c9afe9c68d4a0bd82791614e8 (diff) | |
| download | chromium_src-a2ad62074ea877b0440571c074fe49352e49aa4f.zip chromium_src-a2ad62074ea877b0440571c074fe49352e49aa4f.tar.gz chromium_src-a2ad62074ea877b0440571c074fe49352e49aa4f.tar.bz2 | |
Change ChooserBubbleDelegate class name to ChooserBubbleController
This patch changed ChooserBubbleDelegate class name to
ChooserBubbleController since it better reflects the class's
responsibilities and clarifies the roles of the class.
BUG=492204, 588933
Review URL: https://codereview.chromium.org/1724183005
Cr-Commit-Position: refs/heads/master@{#377989}
Diffstat (limited to 'chrome/browser/ui/bluetooth')
| -rw-r--r-- | chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.cc (renamed from chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc) | 34 | ||||
| -rw-r--r-- | chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.h (renamed from chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.h) | 26 | ||||
| -rw-r--r-- | chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.cc | 16 | ||||
| -rw-r--r-- | chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h | 10 |
4 files changed, 43 insertions, 43 deletions
diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc b/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.cc index 10ad62b..9e9e280 100644 --- a/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc +++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.cc @@ -2,7 +2,7 @@ // 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 "chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.h" #include "base/stl_util.h" #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" @@ -10,26 +10,26 @@ #include "components/bubble/bubble_controller.h" #include "url/gurl.h" -BluetoothChooserBubbleDelegate::BluetoothChooserBubbleDelegate( +BluetoothChooserBubbleController::BluetoothChooserBubbleController( content::RenderFrameHost* owner) - : ChooserBubbleDelegate(owner), bluetooth_chooser_(nullptr) {} + : ChooserBubbleController(owner), bluetooth_chooser_(nullptr) {} -BluetoothChooserBubbleDelegate::~BluetoothChooserBubbleDelegate() { +BluetoothChooserBubbleController::~BluetoothChooserBubbleController() { if (bluetooth_chooser_) - bluetooth_chooser_->set_bluetooth_chooser_bubble_delegate(nullptr); + bluetooth_chooser_->set_bluetooth_chooser_bubble_controller(nullptr); } -size_t BluetoothChooserBubbleDelegate::NumOptions() const { +size_t BluetoothChooserBubbleController::NumOptions() const { return device_names_and_ids_.size(); } -const base::string16& BluetoothChooserBubbleDelegate::GetOption( +const base::string16& BluetoothChooserBubbleController::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) { +void BluetoothChooserBubbleController::Select(size_t index) { DCHECK_LT(index, device_names_and_ids_.size()); if (bluetooth_chooser_) { bluetooth_chooser_->CallEventHandler( @@ -37,32 +37,32 @@ void BluetoothChooserBubbleDelegate::Select(size_t index) { device_names_and_ids_[index].second); } - if (bubble_controller_) - bubble_controller_->CloseBubble(BUBBLE_CLOSE_ACCEPTED); + if (bubble_reference_) + bubble_reference_->CloseBubble(BUBBLE_CLOSE_ACCEPTED); } -void BluetoothChooserBubbleDelegate::Cancel() { +void BluetoothChooserBubbleController::Cancel() { if (bluetooth_chooser_) { bluetooth_chooser_->CallEventHandler( content::BluetoothChooser::Event::CANCELLED, std::string()); } - if (bubble_controller_) - bubble_controller_->CloseBubble(BUBBLE_CLOSE_CANCELED); + if (bubble_reference_) + bubble_reference_->CloseBubble(BUBBLE_CLOSE_CANCELED); } -void BluetoothChooserBubbleDelegate::Close() { +void BluetoothChooserBubbleController::Close() { if (bluetooth_chooser_) { bluetooth_chooser_->CallEventHandler( content::BluetoothChooser::Event::CANCELLED, std::string()); } } -GURL BluetoothChooserBubbleDelegate::GetHelpCenterUrl() const { +GURL BluetoothChooserBubbleController::GetHelpCenterUrl() const { return GURL(chrome::kChooserBluetoothOverviewURL); } -void BluetoothChooserBubbleDelegate::AddDevice( +void BluetoothChooserBubbleController::AddDevice( const std::string& device_id, const base::string16& device_name) { device_names_and_ids_.push_back(std::make_pair(device_name, device_id)); @@ -70,7 +70,7 @@ void BluetoothChooserBubbleDelegate::AddDevice( observer()->OnOptionAdded(device_names_and_ids_.size() - 1); } -void BluetoothChooserBubbleDelegate::RemoveDevice( +void BluetoothChooserBubbleController::RemoveDevice( const std::string& device_id) { for (auto it = device_names_and_ids_.begin(); it != device_names_and_ids_.end(); ++it) { diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.h b/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.h index 26d2455..f619e13 100644 --- a/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.h +++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.h @@ -2,27 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_H_ -#define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_H_ +#ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_CONTROLLER_H_ +#define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_CONTROLLER_H_ #include <stddef.h> #include "base/macros.h" -#include "chrome/browser/ui/website_settings/chooser_bubble_delegate.h" +#include "chrome/browser/ui/website_settings/chooser_bubble_controller.h" #include "components/bubble/bubble_reference.h" class BluetoothChooserDesktop; -// BluetoothChooserBubbleDelegate is a chooser that presents a list of +// BluetoothChooserBubbleController is a chooser that presents a list of // Bluetooth device names, which come from |bluetooth_chooser_desktop_|. // It can be used by WebBluetooth API to get the user's permission to // access a Bluetooth device. -class BluetoothChooserBubbleDelegate : public ChooserBubbleDelegate { +class BluetoothChooserBubbleController : public ChooserBubbleController { public: - explicit BluetoothChooserBubbleDelegate(content::RenderFrameHost* owner); - ~BluetoothChooserBubbleDelegate() override; + explicit BluetoothChooserBubbleController(content::RenderFrameHost* owner); + ~BluetoothChooserBubbleController() override; - // ChooserBubbleDelegate: + // ChooserBubbleController: size_t NumOptions() const override; const base::string16& GetOption(size_t index) const override; void Select(size_t index) override; @@ -41,17 +41,17 @@ class BluetoothChooserBubbleDelegate : public ChooserBubbleDelegate { bluetooth_chooser_ = bluetooth_chooser; } - void set_bubble_controller(BubbleReference bubble_controller) { - bubble_controller_ = bubble_controller; + void set_bubble_reference(BubbleReference bubble_reference) { + bubble_reference_ = bubble_reference; } private: // Each pair is a (device name, device id). std::vector<std::pair<base::string16, std::string>> device_names_and_ids_; BluetoothChooserDesktop* bluetooth_chooser_; - BubbleReference bubble_controller_; + BubbleReference bubble_reference_; - DISALLOW_COPY_AND_ASSIGN(BluetoothChooserBubbleDelegate); + DISALLOW_COPY_AND_ASSIGN(BluetoothChooserBubbleController); }; -#endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_DELEGATE_H_ +#endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_BUBBLE_CONTROLLER_H_ diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.cc b/chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.cc index 91bc638..b014048 100644 --- a/chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.cc +++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.cc @@ -4,16 +4,16 @@ #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" -#include "chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.h" +#include "chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.h" BluetoothChooserDesktop::BluetoothChooserDesktop( const content::BluetoothChooser::EventHandler& event_handler) : event_handler_(event_handler), - bluetooth_chooser_bubble_delegate_(nullptr) {} + bluetooth_chooser_bubble_controller_(nullptr) {} BluetoothChooserDesktop::~BluetoothChooserDesktop() { - if (bluetooth_chooser_bubble_delegate_) - bluetooth_chooser_bubble_delegate_->set_bluetooth_chooser(nullptr); + if (bluetooth_chooser_bubble_controller_) + bluetooth_chooser_bubble_controller_->set_bluetooth_chooser(nullptr); } void BluetoothChooserDesktop::SetAdapterPresence(AdapterPresence presence) {} @@ -22,13 +22,13 @@ void BluetoothChooserDesktop::ShowDiscoveryState(DiscoveryState state) {} void BluetoothChooserDesktop::AddDevice(const std::string& device_id, const base::string16& device_name) { - if (bluetooth_chooser_bubble_delegate_) - bluetooth_chooser_bubble_delegate_->AddDevice(device_id, device_name); + if (bluetooth_chooser_bubble_controller_) + bluetooth_chooser_bubble_controller_->AddDevice(device_id, device_name); } void BluetoothChooserDesktop::RemoveDevice(const std::string& device_id) { - if (bluetooth_chooser_bubble_delegate_) - bluetooth_chooser_bubble_delegate_->RemoveDevice(device_id); + if (bluetooth_chooser_bubble_controller_) + bluetooth_chooser_bubble_controller_->RemoveDevice(device_id); } void BluetoothChooserDesktop::CallEventHandler( diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h b/chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h index 9809640..ccd2817 100644 --- a/chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h +++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h @@ -8,7 +8,7 @@ #include "base/macros.h" #include "content/public/browser/bluetooth_chooser.h" -class BluetoothChooserBubbleDelegate; +class BluetoothChooserBubbleController; // Represents a Bluetooth chooser to ask the user to select a Bluetooth // device from a list of options. This implementation is for desktop. @@ -26,9 +26,9 @@ class BluetoothChooserDesktop : public content::BluetoothChooser { const base::string16& device_name) override; void RemoveDevice(const std::string& device_id) override; - void set_bluetooth_chooser_bubble_delegate( - BluetoothChooserBubbleDelegate* bluetooth_chooser_bubble_delegate) { - bluetooth_chooser_bubble_delegate_ = bluetooth_chooser_bubble_delegate; + void set_bluetooth_chooser_bubble_controller( + BluetoothChooserBubbleController* bluetooth_chooser_bubble_controller) { + bluetooth_chooser_bubble_controller_ = bluetooth_chooser_bubble_controller; } // Use this function to call event_handler_. @@ -37,7 +37,7 @@ class BluetoothChooserDesktop : public content::BluetoothChooser { private: content::BluetoothChooser::EventHandler event_handler_; - BluetoothChooserBubbleDelegate* bluetooth_chooser_bubble_delegate_; + BluetoothChooserBubbleController* bluetooth_chooser_bubble_controller_; DISALLOW_COPY_AND_ASSIGN(BluetoothChooserDesktop); }; |
