| 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/ui/website_settings/mock_permission_prompt_factory.h" | 5 #include "chrome/browser/ui/website_settings/mock_permission_prompt_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 Browser* browser) { | 77 Browser* browser) { |
| 78 NOTREACHED(); | 78 NOTREACHED(); |
| 79 return base::WrapUnique(new MockPermissionPrompt(nullptr, nullptr)); | 79 return base::WrapUnique(new MockPermissionPrompt(nullptr, nullptr)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void MockPermissionPromptFactory::UpdateResponseType() { | 82 void MockPermissionPromptFactory::UpdateResponseType() { |
| 83 manager_->set_auto_response_for_test(response_type_); | 83 manager_->set_auto_response_for_test(response_type_); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void MockPermissionPromptFactory::ShowView(MockPermissionPrompt* prompt) { | 86 void MockPermissionPromptFactory::ShowView(MockPermissionPrompt* prompt) { |
| 87 if (ContainsValue(prompts_, prompt)) | 87 if (base::ContainsValue(prompts_, prompt)) |
| 88 return; | 88 return; |
| 89 prompts_.push_back(prompt); | 89 prompts_.push_back(prompt); |
| 90 | 90 |
| 91 if (!show_bubble_quit_closure_.is_null()) | 91 if (!show_bubble_quit_closure_.is_null()) |
| 92 show_bubble_quit_closure_.Run(); | 92 show_bubble_quit_closure_.Run(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void MockPermissionPromptFactory::HideView(MockPermissionPrompt* prompt) { | 95 void MockPermissionPromptFactory::HideView(MockPermissionPrompt* prompt) { |
| 96 auto it = std::find(prompts_.begin(), prompts_.end(), prompt); | 96 auto it = std::find(prompts_.begin(), prompts_.end(), prompt); |
| 97 if (it != prompts_.end()) | 97 if (it != prompts_.end()) |
| 98 prompts_.erase(it); | 98 prompts_.erase(it); |
| 99 } | 99 } |
| OLD | NEW |