| 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_bubble_factory.h" | 5 #include "chrome/browser/ui/website_settings/mock_permission_bubble_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 "chrome/browser/permissions/permission_request_manager.h" |
| 10 #include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h" | 11 #include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h" |
| 11 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | |
| 12 | 12 |
| 13 MockPermissionBubbleFactory::MockPermissionBubbleFactory( | 13 MockPermissionBubbleFactory::MockPermissionBubbleFactory( |
| 14 PermissionBubbleManager* manager) | 14 PermissionRequestManager* manager) |
| 15 : can_update_ui_(false), | 15 : can_update_ui_(false), |
| 16 show_count_(0), | 16 show_count_(0), |
| 17 requests_count_(0), | 17 requests_count_(0), |
| 18 total_requests_count_(0), | 18 total_requests_count_(0), |
| 19 response_type_(PermissionBubbleManager::NONE), | 19 response_type_(PermissionRequestManager::NONE), |
| 20 manager_(manager) { | 20 manager_(manager) { |
| 21 manager->view_factory_ = | 21 manager->view_factory_ = |
| 22 base::Bind(&MockPermissionBubbleFactory::Create, base::Unretained(this)); | 22 base::Bind(&MockPermissionBubbleFactory::Create, base::Unretained(this)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 MockPermissionBubbleFactory::~MockPermissionBubbleFactory() { | 25 MockPermissionBubbleFactory::~MockPermissionBubbleFactory() { |
| 26 manager_->view_factory_ = | 26 manager_->view_factory_ = |
| 27 base::Bind(&MockPermissionBubbleFactory::DoNotCreate); | 27 base::Bind(&MockPermissionBubbleFactory::DoNotCreate); |
| 28 while (!views_.empty()) { | 28 while (!views_.empty()) { |
| 29 views_.back()->factory_ = nullptr; | 29 views_.back()->factory_ = nullptr; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 void MockPermissionBubbleFactory::HideView(MockPermissionBubbleView* view) { | 100 void MockPermissionBubbleFactory::HideView(MockPermissionBubbleView* view) { |
| 101 for (std::vector<MockPermissionBubbleView*>::iterator iter = views_.begin(); | 101 for (std::vector<MockPermissionBubbleView*>::iterator iter = views_.begin(); |
| 102 iter != views_.end(); ++iter) { | 102 iter != views_.end(); ++iter) { |
| 103 if (*iter == view) { | 103 if (*iter == view) { |
| 104 views_.erase(iter); | 104 views_.erase(iter); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 } | 108 } |
| OLD | NEW |