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

Side by Side Diff: chrome/browser/ui/permission_bubble/mock_permission_prompt_factory.cc

Issue 2947593005: Use ContainsValue() instead of std::find() in chrome/browser/ui/ (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
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/permission_bubble/mock_permission_prompt_factory.h" 5 #include "chrome/browser/ui/permission_bubble/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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return true; 60 return true;
61 } 61 }
62 return false; 62 return false;
63 } 63 }
64 64
65 int MockPermissionPromptFactory::TotalRequestCount() { 65 int MockPermissionPromptFactory::TotalRequestCount() {
66 return request_types_seen_.size(); 66 return request_types_seen_.size();
67 } 67 }
68 68
69 bool MockPermissionPromptFactory::RequestTypeSeen(PermissionRequestType type) { 69 bool MockPermissionPromptFactory::RequestTypeSeen(PermissionRequestType type) {
70 return std::find(request_types_seen_.begin(), request_types_seen_.end(), 70 return base::ContainsValue(request_types_seen_, type);
71 type) != request_types_seen_.end();
72 } 71 }
73 72
74 void MockPermissionPromptFactory::WaitForPermissionBubble() { 73 void MockPermissionPromptFactory::WaitForPermissionBubble() {
75 if (is_visible()) 74 if (is_visible())
76 return; 75 return;
77 DCHECK(show_bubble_quit_closure_.is_null()); 76 DCHECK(show_bubble_quit_closure_.is_null());
78 base::RunLoop loop; 77 base::RunLoop loop;
79 show_bubble_quit_closure_ = loop.QuitClosure(); 78 show_bubble_quit_closure_ = loop.QuitClosure();
80 loop.Run(); 79 loop.Run();
81 show_bubble_quit_closure_ = base::Closure(); 80 show_bubble_quit_closure_ = base::Closure();
(...skipping 17 matching lines...) Expand all
99 98
100 if (!show_bubble_quit_closure_.is_null()) 99 if (!show_bubble_quit_closure_.is_null())
101 show_bubble_quit_closure_.Run(); 100 show_bubble_quit_closure_.Run();
102 } 101 }
103 102
104 void MockPermissionPromptFactory::HideView(MockPermissionPrompt* prompt) { 103 void MockPermissionPromptFactory::HideView(MockPermissionPrompt* prompt) {
105 auto it = std::find(prompts_.begin(), prompts_.end(), prompt); 104 auto it = std::find(prompts_.begin(), prompts_.end(), prompt);
106 if (it != prompts_.end()) 105 if (it != prompts_.end())
107 prompts_.erase(it); 106 prompts_.erase(it);
108 } 107 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/input_method/input_method_engine.cc ('k') | chrome/browser/ui/views/tabs/tab_drag_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698