| 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 "chrome/browser/permissions/permission_request_manager.h" |
| 9 #include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h" | 10 #include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h" |
| 10 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | |
| 11 | 11 |
| 12 MockPermissionBubbleFactory::MockPermissionBubbleFactory( | 12 MockPermissionBubbleFactory::MockPermissionBubbleFactory( |
| 13 bool is_browser_test, | 13 bool is_browser_test, |
| 14 PermissionBubbleManager* manager) | 14 PermissionRequestManager* manager) |
| 15 : is_browser_test_(is_browser_test), | 15 : is_browser_test_(is_browser_test), |
| 16 can_update_ui_(false), | 16 can_update_ui_(false), |
| 17 show_count_(0), | 17 show_count_(0), |
| 18 requests_count_(0), | 18 requests_count_(0), |
| 19 total_requests_count_(0), | 19 total_requests_count_(0), |
| 20 response_type_(PermissionBubbleManager::NONE), | 20 response_type_(PermissionRequestManager::NONE), |
| 21 manager_(manager) { | 21 manager_(manager) { |
| 22 manager->view_factory_ = | 22 manager->view_factory_ = |
| 23 base::Bind(&MockPermissionBubbleFactory::Create, base::Unretained(this)); | 23 base::Bind(&MockPermissionBubbleFactory::Create, base::Unretained(this)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 MockPermissionBubbleFactory::~MockPermissionBubbleFactory() { | 26 MockPermissionBubbleFactory::~MockPermissionBubbleFactory() { |
| 27 manager_->view_factory_ = | 27 manager_->view_factory_ = |
| 28 base::Bind(&MockPermissionBubbleFactory::DoNotCreate); | 28 base::Bind(&MockPermissionBubbleFactory::DoNotCreate); |
| 29 while (!views_.empty()) { | 29 while (!views_.empty()) { |
| 30 views_.back()->factory_ = nullptr; | 30 views_.back()->factory_ = nullptr; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 void MockPermissionBubbleFactory::HideView(MockPermissionBubbleView* view) { | 88 void MockPermissionBubbleFactory::HideView(MockPermissionBubbleView* view) { |
| 89 for (std::vector<MockPermissionBubbleView*>::iterator iter = views_.begin(); | 89 for (std::vector<MockPermissionBubbleView*>::iterator iter = views_.begin(); |
| 90 iter != views_.end(); ++iter) { | 90 iter != views_.end(); ++iter) { |
| 91 if (*iter == view) { | 91 if (*iter == view) { |
| 92 views_.erase(iter); | 92 views_.erase(iter); |
| 93 return; | 93 return; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 } | 96 } |
| OLD | NEW |