| OLD | NEW |
| 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/extensions/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 virtual void UnloadExtension( | 43 virtual void UnloadExtension( |
| 44 const std::string& extension_id, | 44 const std::string& extension_id, |
| 45 extension_misc::UnloadedExtensionReason reason) OVERRIDE { | 45 extension_misc::UnloadedExtensionReason reason) OVERRIDE { |
| 46 ASSERT_TRUE(extension_set_.Contains(extension_id)); | 46 ASSERT_TRUE(extension_set_.Contains(extension_id)); |
| 47 // Remove the extension with the matching id. | 47 // Remove the extension with the matching id. |
| 48 extension_set_.Remove(extension_id); | 48 extension_set_.Remove(extension_id); |
| 49 unloaded_count_++; | 49 unloaded_count_++; |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual void RemoveComponentExtension(const std::string & extension_id) |
| 53 OVERRIDE { |
| 54 UnloadExtension(extension_id, extension_misc::UNLOAD_REASON_DISABLE); |
| 55 } |
| 56 |
| 52 virtual bool is_ready() OVERRIDE { | 57 virtual bool is_ready() OVERRIDE { |
| 53 return ready_; | 58 return ready_; |
| 54 } | 59 } |
| 55 | 60 |
| 56 virtual const ExtensionSet* extensions() const OVERRIDE { | 61 virtual const ExtensionSet* extensions() const OVERRIDE { |
| 57 return &extension_set_; | 62 return &extension_set_; |
| 58 } | 63 } |
| 59 | 64 |
| 60 void set_ready(bool ready) { | 65 void set_ready(bool ready) { |
| 61 ready_ = ready; | 66 ready_ = ready; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 component_loader_.AddOrReplace(known_extension); | 266 component_loader_.AddOrReplace(known_extension); |
| 262 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); | 267 EXPECT_EQ(default_count + 1, extension_service_.extensions()->size()); |
| 263 EXPECT_EQ(1u, extension_service_.unloaded_count()); | 268 EXPECT_EQ(1u, extension_service_.unloaded_count()); |
| 264 | 269 |
| 265 // Add an invalid component extension. | 270 // Add an invalid component extension. |
| 266 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); | 271 std::string extension_id = component_loader_.AddOrReplace(invalid_extension); |
| 267 EXPECT_TRUE(extension_id.empty()); | 272 EXPECT_TRUE(extension_id.empty()); |
| 268 } | 273 } |
| 269 | 274 |
| 270 } // namespace extensions | 275 } // namespace extensions |
| OLD | NEW |