OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |