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

Side by Side Diff: chrome/browser/content_settings/tab_specific_content_settings.cc

Issue 2958223002: Use ContainsValue() instead of std::find() in chrome/browser and chrome/common (Closed)
Patch Set: Rebase patch. Created 3 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/content_settings/tab_specific_content_settings.h" 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/stl_util.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
15 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 16 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
16 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" 17 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
17 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" 18 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
18 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" 19 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
19 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" 20 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
20 #include "chrome/browser/browsing_data/cookies_tree_model.h" 21 #include "chrome/browser/browsing_data/cookies_tree_model.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // For Android we do not have a persistent button that will always be 324 // For Android we do not have a persistent button that will always be
324 // visible for blocked popups. Instead we have info bars which could be 325 // visible for blocked popups. Instead we have info bars which could be
325 // dismissed. Have to clear the blocked state so we properly notify the 326 // dismissed. Have to clear the blocked state so we properly notify the
326 // relevant pieces again. 327 // relevant pieces again.
327 status.blocked = false; 328 status.blocked = false;
328 status.blockage_indicated_to_user = false; 329 status.blockage_indicated_to_user = false;
329 } 330 }
330 #endif 331 #endif
331 332
332 if (type == CONTENT_SETTINGS_TYPE_PLUGINS && !details.empty() && 333 if (type == CONTENT_SETTINGS_TYPE_PLUGINS && !details.empty() &&
333 std::find(blocked_plugin_names_.begin(), blocked_plugin_names_.end(), 334 !base::ContainsValue(blocked_plugin_names_, details)) {
334 details) == blocked_plugin_names_.end()) {
335 blocked_plugin_names_.push_back(details); 335 blocked_plugin_names_.push_back(details);
336 } 336 }
337 337
338 if (!status.blocked) { 338 if (!status.blocked) {
339 status.blocked = true; 339 status.blocked = true;
340 // TODO: it would be nice to have a way of mocking this in tests. 340 // TODO: it would be nice to have a way of mocking this in tests.
341 content::NotificationService::current()->Notify( 341 content::NotificationService::current()->Notify(
342 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, 342 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
343 content::Source<WebContents>(web_contents()), 343 content::Source<WebContents>(web_contents()),
344 content::NotificationService::NoDetails()); 344 content::NotificationService::NoDetails());
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 static_cast<MicrophoneCameraStateFlags>( 885 static_cast<MicrophoneCameraStateFlags>(
886 TabSpecificContentSettings::MICROPHONE_ACCESSED | 886 TabSpecificContentSettings::MICROPHONE_ACCESSED |
887 TabSpecificContentSettings::MICROPHONE_BLOCKED | 887 TabSpecificContentSettings::MICROPHONE_BLOCKED |
888 TabSpecificContentSettings::CAMERA_ACCESSED | 888 TabSpecificContentSettings::CAMERA_ACCESSED |
889 TabSpecificContentSettings::CAMERA_BLOCKED); 889 TabSpecificContentSettings::CAMERA_BLOCKED);
890 OnMediaStreamPermissionSet( 890 OnMediaStreamPermissionSet(
891 web_contents()->GetLastCommittedURL(), 891 web_contents()->GetLastCommittedURL(),
892 media_blocked, 892 media_blocked,
893 std::string(), std::string(), std::string(), std::string()); 893 std::string(), std::string(), std::string(), std::string());
894 } 894 }
OLDNEW
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | chrome/browser/custom_handlers/protocol_handler_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698