OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/extensions/active_script_controller.h" | 8 #include "chrome/browser/extensions/active_script_controller.h" |
9 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 9 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 // Returns a closure to use as a script execution for a given extension. | 67 // Returns a closure to use as a script execution for a given extension. |
68 base::Closure GetExecutionCallbackForExtension( | 68 base::Closure GetExecutionCallbackForExtension( |
69 const std::string& extension_id); | 69 const std::string& extension_id); |
70 | 70 |
71 // Increment the number of executions for the given |extension_id|. | 71 // Increment the number of executions for the given |extension_id|. |
72 void IncrementExecutionCount(const std::string& extension_id); | 72 void IncrementExecutionCount(const std::string& extension_id); |
73 | 73 |
74 virtual void SetUp() OVERRIDE; | 74 virtual void SetUp() override; |
75 | 75 |
76 // Since ActiveScriptController's behavior is behind a flag, override the | 76 // Since ActiveScriptController's behavior is behind a flag, override the |
77 // feature switch. | 77 // feature switch. |
78 FeatureSwitch::ScopedOverride feature_override_; | 78 FeatureSwitch::ScopedOverride feature_override_; |
79 | 79 |
80 // The associated ActiveScriptController. | 80 // The associated ActiveScriptController. |
81 ActiveScriptController* active_script_controller_; | 81 ActiveScriptController* active_script_controller_; |
82 | 82 |
83 // The map of observed executions, keyed by extension id. | 83 // The map of observed executions, keyed by extension id. |
84 std::map<std::string, int> extension_executions_; | 84 std::map<std::string, int> extension_executions_; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 EXPECT_TRUE(RequiresUserConsent(extension)); | 411 EXPECT_TRUE(RequiresUserConsent(extension)); |
412 // Different subdomain... | 412 // Different subdomain... |
413 NavigateAndCommit(GURL("https://en.google.com/foo/bar")); | 413 NavigateAndCommit(GURL("https://en.google.com/foo/bar")); |
414 EXPECT_TRUE(RequiresUserConsent(extension)); | 414 EXPECT_TRUE(RequiresUserConsent(extension)); |
415 // Only the "always run" origin should be allowed to run without user consent. | 415 // Only the "always run" origin should be allowed to run without user consent. |
416 NavigateAndCommit(GURL("https://www.google.com/foo/bar")); | 416 NavigateAndCommit(GURL("https://www.google.com/foo/bar")); |
417 EXPECT_FALSE(RequiresUserConsent(extension)); | 417 EXPECT_FALSE(RequiresUserConsent(extension)); |
418 } | 418 } |
419 | 419 |
420 } // namespace extensions | 420 } // namespace extensions |
OLD | NEW |