Commit 847abdcf authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski Committed by Commit Bot

Migrate extension_ids from string to ExtensionId.

Bug: None
Test: All tests pass and everything compiles.
Change-Id: Ic803b150499e20ed576c70a6b398eff4ab62109d
Reviewed-on: https://chromium-review.googlesource.com/802845
Commit-Queue: Tomasz Mikolajewski <mtomasz@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521624}
parent 839cd450
......@@ -9,6 +9,7 @@
#include "base/memory/ptr_util.h"
#include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
#include "extensions/browser/event_router.h"
#include "extensions/common/extension_id.h"
namespace chromeos {
namespace file_system_provider {
......@@ -18,7 +19,7 @@ namespace {
// Default implementation for dispatching an event. Can be replaced for unit
// tests by Operation::SetDispatchEventImplForTest().
bool DispatchEventImpl(extensions::EventRouter* event_router,
const std::string& extension_id,
const extensions::ExtensionId& extension_id,
std::unique_ptr<extensions::Event> event) {
if (!event_router->ExtensionHasEventListener(extension_id, event->event_name))
return false;
......
......@@ -16,7 +16,8 @@ ProviderId::ProviderId(const std::string& internal_id,
ProviderId::ProviderId() : type_(INVALID) {}
// static
ProviderId ProviderId::CreateFromExtensionId(const std::string& extension_id) {
ProviderId ProviderId::CreateFromExtensionId(
const extensions::ExtensionId& extension_id) {
return ProviderId(extension_id, EXTENSION);
}
......@@ -25,7 +26,7 @@ ProviderId ProviderId::CreateFromNativeId(const std::string& native_id) {
return ProviderId(native_id, NATIVE);
}
const std::string& ProviderId::GetExtensionId() const {
const extensions::ExtensionId& ProviderId::GetExtensionId() const {
CHECK_EQ(EXTENSION, type_);
return internal_id_;
}
......@@ -111,7 +112,7 @@ ProvidedFileSystemInfo::ProvidedFileSystemInfo(
}
ProvidedFileSystemInfo::ProvidedFileSystemInfo(
const std::string& extension_id,
const extensions::ExtensionId& extension_id,
const MountOptions& mount_options,
const base::FilePath& mount_path,
bool configurable,
......
......@@ -9,6 +9,7 @@
#include "base/files/file_path.h"
#include "chrome/common/extensions/api/file_system_provider_capabilities/file_system_provider_capabilities_handler.h"
#include "extensions/common/extension_id.h"
namespace chromeos {
namespace file_system_provider {
......@@ -36,11 +37,12 @@ class ProviderId {
enum ProviderType : uint32_t { EXTENSION, NATIVE, INVALID };
ProviderId();
static ProviderId CreateFromExtensionId(const std::string& extension_id);
static ProviderId CreateFromExtensionId(
const extensions::ExtensionId& extension_id);
static ProviderId CreateFromNativeId(const std::string& native_id);
const std::string& GetIdUnsafe() const;
const std::string& GetExtensionId() const;
const extensions::ExtensionId& GetExtensionId() const;
const std::string& GetNativeId() const;
std::string ToString() const;
ProviderType GetType() const;
......@@ -67,7 +69,7 @@ class ProvidedFileSystemInfo {
bool watchable,
extensions::FileSystemProviderSource source);
ProvidedFileSystemInfo(const std::string& extension_id,
ProvidedFileSystemInfo(const extensions::ExtensionId& extension_id,
const MountOptions& mount_options,
const base::FilePath& mount_path,
bool configurable,
......
......@@ -29,6 +29,7 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/event_router.h"
#include "extensions/common/extension_id.h"
#include "storage/browser/fileapi/watcher_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -62,7 +63,7 @@ class FakeEventRouter : public extensions::EventRouter {
// Handles an event which would normally be routed to an extension. Instead
// replies with a hard coded response.
void DispatchEventToExtension(
const std::string& extension_id,
const extensions::ExtensionId& extension_id,
std::unique_ptr<extensions::Event> event) override {
ASSERT_TRUE(file_system_);
std::string file_system_id;
......
......@@ -24,6 +24,7 @@
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/permissions_data.h"
#include "storage/browser/fileapi/external_mount_points.h"
......@@ -321,8 +322,9 @@ std::vector<ProvidingExtensionInfo> Service::GetProvidingExtensionInfoList()
// TODO(mtomasz): Refactor providers into per-filesystem, enabling this code
// duplication to be removed.
bool Service::GetProvidingExtensionInfo(const std::string& extension_id,
ProvidingExtensionInfo* result) const {
bool Service::GetProvidingExtensionInfo(
const extensions::ExtensionId& extension_id,
ProvidingExtensionInfo* result) const {
DCHECK(result);
extensions::ExtensionRegistry* const registry =
extensions::ExtensionRegistry::Get(profile_);
......
......@@ -127,7 +127,7 @@ class Service : public KeyedService,
// Fills information of the specified providing extension and returns true.
// If the extension is not a provider, or it doesn't exist, then false is
// returned.
bool GetProvidingExtensionInfo(const std::string& extension_id,
bool GetProvidingExtensionInfo(const extensions::ExtensionId& extension_id,
ProvidingExtensionInfo* result) const;
// Adds and removes observers.
......
......@@ -34,6 +34,7 @@
#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest_constants.h"
#include "storage/browser/fileapi/external_mount_points.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -56,7 +57,7 @@ const char kFileSystemId[] = "camera/pictures/id .!@#$%^&*()_+";
// Creates a fake extension with the specified |extension_id|.
// TODO(mtomasz): Use the extension builder.
scoped_refptr<extensions::Extension> CreateFakeExtension(
const std::string& extension_id) {
const extensions::ExtensionId& extension_id) {
base::DictionaryValue manifest;
std::string error;
manifest.SetKey(extensions::manifest_keys::kVersion, base::Value("1.0.0.0"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment