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

Unified Diff: components/chooser_controller/mock_chooser_controller.cc

Issue 2029863002: Refactor ChooserBubbleUiViewDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make ChooserContentView::ChooserControllerDestroying a private function Created 4 years, 6 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
« no previous file with comments | « components/chooser_controller/mock_chooser_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/chooser_controller/mock_chooser_controller.cc
diff --git a/components/chooser_controller/mock_chooser_controller.cc b/components/chooser_controller/mock_chooser_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bc40544f1703a7f5d00b9742e61f18ad984d8f50
--- /dev/null
+++ b/components/chooser_controller/mock_chooser_controller.cc
@@ -0,0 +1,36 @@
+// Copyright 2016 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 "components/chooser_controller/mock_chooser_controller.h"
+
+MockChooserController::MockChooserController(content::RenderFrameHost* owner)
+ : ChooserController(owner) {}
+
+MockChooserController::~MockChooserController() {}
+
+size_t MockChooserController::NumOptions() const {
+ return option_names_.size();
+}
+
+const base::string16& MockChooserController::GetOption(size_t index) const {
+ return option_names_[index];
+}
+
+void MockChooserController::OptionAdded(const base::string16 option_name) {
+ option_names_.push_back(option_name);
+ if (observer())
+ observer()->OnOptionAdded(option_names_.size() - 1);
+}
+
+void MockChooserController::OptionRemoved(const base::string16 option_name) {
+ for (auto it = option_names_.begin(); it != option_names_.end(); ++it) {
+ if (*it == option_name) {
+ size_t index = it - option_names_.begin();
+ option_names_.erase(it);
+ if (observer())
+ observer()->OnOptionRemoved(index);
+ return;
+ }
+ }
+}
« no previous file with comments | « components/chooser_controller/mock_chooser_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698