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

Side by Side Diff: chrome/browser/chooser_controller/mock_chooser_controller.cc

Issue 2163683005: Change ChooserController::Observer to ChooserController::View (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chooser_controller/mock_chooser_controller.h" 5 #include "chrome/browser/chooser_controller/mock_chooser_controller.h"
6 6
7 #include "chrome/grit/generated_resources.h" 7 #include "chrome/grit/generated_resources.h"
8 #include "ui/base/l10n/l10n_util.h" 8 #include "ui/base/l10n/l10n_util.h"
9 9
10 MockChooserController::MockChooserController(content::RenderFrameHost* owner) 10 MockChooserController::MockChooserController(content::RenderFrameHost* owner)
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 void MockChooserController::RefreshOptions() {} 33 void MockChooserController::RefreshOptions() {}
34 34
35 base::string16 MockChooserController::GetStatus() const { 35 base::string16 MockChooserController::GetStatus() const {
36 return base::string16(); 36 return base::string16();
37 } 37 }
38 38
39 void MockChooserController::OptionAdded(const base::string16 option_name) { 39 void MockChooserController::OptionAdded(const base::string16 option_name) {
40 option_names_.push_back(option_name); 40 option_names_.push_back(option_name);
41 if (observer()) 41 if (view())
42 observer()->OnOptionAdded(option_names_.size() - 1); 42 view()->OnOptionAdded(option_names_.size() - 1);
43 } 43 }
44 44
45 void MockChooserController::OptionRemoved(const base::string16 option_name) { 45 void MockChooserController::OptionRemoved(const base::string16 option_name) {
46 for (auto it = option_names_.begin(); it != option_names_.end(); ++it) { 46 for (auto it = option_names_.begin(); it != option_names_.end(); ++it) {
47 if (*it == option_name) { 47 if (*it == option_name) {
48 size_t index = it - option_names_.begin(); 48 size_t index = it - option_names_.begin();
49 option_names_.erase(it); 49 option_names_.erase(it);
50 if (observer()) 50 if (view())
51 observer()->OnOptionRemoved(index); 51 view()->OnOptionRemoved(index);
52 return; 52 return;
53 } 53 }
54 } 54 }
55 } 55 }
OLDNEW
« no previous file with comments | « chrome/browser/chooser_controller/chooser_controller.h ('k') | chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698