Commit dc99ab10 authored by rdevlin.cronin's avatar rdevlin.cronin Committed by Commit bot

[Extensions] Remove principalsPrivate API

BUG=595168

Review URL: https://codereview.chromium.org/1806723003

Cr-Commit-Position: refs/heads/master@{#381591}
parent 3edbd8d0
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/principals_private/principals_private_api.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/avatar_menu.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "components/signin/core/browser/signin_header_helper.h"
#include "components/signin/core/browser/signin_metrics.h"
#include "components/signin/core/common/profile_management_switches.h"
namespace extensions {
bool PrincipalsPrivateExtensionFunction::RunSync() {
if (!switches::IsEnableAccountConsistency()) {
SetError(
"Need to enable account consistency to use principalsPrivate API.");
return false;
}
return RunSyncSafe();
}
bool PrincipalsPrivateSignOutFunction::RunSyncSafe() {
Browser* browser = GetCurrentBrowser();
if (browser) {
profiles::LockProfile(browser->profile());
}
return true;
}
bool PrincipalsPrivateShowAvatarBubbleFunction::RunSyncSafe() {
Browser* browser = GetCurrentBrowser();
if (browser) {
browser->window()->ShowAvatarBubbleFromAvatarButton(
BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT,
signin::ManageAccountsParams(),
signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN);
}
return true;
}
} // namespace extensions
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_PRINCIPALS_PRIVATE_PRINCIPALS_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_PRINCIPALS_PRIVATE_PRINCIPALS_PRIVATE_API_H_
#include "base/macros.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
// WARNING: chrome.principalsPrivate is a set of experimental APIs for the new
// profile management flows. Every new API must extend
// PrincipalsPrivateExtensionFunction which is guarded with a flag check
// for "new-profile-management".
namespace extensions {
class PrincipalsPrivateExtensionFunction : public ChromeSyncExtensionFunction {
public:
PrincipalsPrivateExtensionFunction() {}
protected:
~PrincipalsPrivateExtensionFunction() override {}
// ExtensionFunction:
// Checks for the flag "new-profile-management", if set calls
// RunSyncSafe which must be overriden by subclasses.
bool RunSync() final;
private:
virtual bool RunSyncSafe() = 0;
};
class PrincipalsPrivateSignOutFunction
: public PrincipalsPrivateExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("principalsPrivate.signOut",
PRINCIPALSPRIVATE_SIGNOUT);
PrincipalsPrivateSignOutFunction() {}
protected:
~PrincipalsPrivateSignOutFunction() override {}
private:
// PrincipalsPrivateExtensionFunction
bool RunSyncSafe() override;
DISALLOW_COPY_AND_ASSIGN(PrincipalsPrivateSignOutFunction);
};
class PrincipalsPrivateShowAvatarBubbleFunction
: public PrincipalsPrivateExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("principalsPrivate.showAvatarBubble",
PRINCIPALSPRIVATE_SHOWAVATARBUBBLE);
PrincipalsPrivateShowAvatarBubbleFunction() {}
protected:
~PrincipalsPrivateShowAvatarBubbleFunction() override {}
private:
// PrincipalsPrivateExtensionFunction
bool RunSyncSafe() override;
DISALLOW_COPY_AND_ASSIGN(PrincipalsPrivateShowAvatarBubbleFunction);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_PRINCIPALS_PRIVATE_PRINCIPALS_PRIVATE_API_H_
......@@ -429,8 +429,6 @@
'browser/extensions/api/preference/preference_api_constants.h',
'browser/extensions/api/preference/preference_helpers.cc',
'browser/extensions/api/preference/preference_helpers.h',
'browser/extensions/api/principals_private/principals_private_api.cc',
'browser/extensions/api/principals_private/principals_private_api.h',
'browser/extensions/api/proxy/proxy_api.cc',
'browser/extensions/api/proxy/proxy_api.h',
'browser/extensions/api/proxy/proxy_api_constants.cc',
......
......@@ -670,10 +670,6 @@
"dependencies": ["permission:preferencesPrivate"],
"contexts": ["blessed_extension"]
},
"principalsPrivate": {
"dependencies": ["permission:principalsPrivate"],
"contexts": ["blessed_extension"]
},
"privacy": {
"dependencies": ["permission:privacy"],
"contexts": ["blessed_extension"]
......
......@@ -807,13 +807,6 @@
"location": "component"
}
],
"principalsPrivate": {
"channel": "stable",
"extension_types": ["extension"],
"whitelist": [
"2779FA8B45841D61A37207CCFAC9CB393964FE5B" // Login Proxy (prototype)
]
},
"privacy": {
"channel": "stable",
"extension_types": ["extension", "legacy_packaged_app"]
......
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Experimental APIs to trigger Chrome sign in actions.
// Only enabled if the flag "new-profile-management" is set.
namespace principalsPrivate {
interface Functions {
// Triggers Chrome sign out.
// Only enabled if the flag "new-profile-management" is set.
static void signOut();
// Shows the avatar bubble.
// Only enabled if the flag "new-profile-management" is set.
static void showAvatarBubble();
};
};
......@@ -97,7 +97,6 @@
'extension.json',
'idltest.idl',
'music_manager_private.idl',
'principals_private.idl',
'top_sites.json',
],
......
......@@ -182,8 +182,6 @@ std::vector<APIPermissionInfo*> ChromeAPIPermissions::GetAllPermissions()
"webrtcDesktopCapturePrivate", APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kWebrtcLoggingPrivate, "webrtcLoggingPrivate",
APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kPrincipalsPrivate, "principalsPrivate",
APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kFirstRunPrivate, "firstRunPrivate",
APIPermissionInfo::kFlagCannotBeOptional},
{APIPermission::kInlineInstallPrivate, "inlineInstallPrivate"},
......
......@@ -843,7 +843,6 @@ TEST(PermissionsTest, PermissionMessages) {
skip.insert(APIPermission::kMediaRouterPrivate);
skip.insert(APIPermission::kMetricsPrivate);
skip.insert(APIPermission::kPreferencesPrivate);
skip.insert(APIPermission::kPrincipalsPrivate);
skip.insert(APIPermission::kImageWriterPrivate);
skip.insert(APIPermission::kResourcesPrivate);
skip.insert(APIPermission::kRtcPrivate);
......
......@@ -161,7 +161,7 @@ class APIPermission {
kPlugin,
kPower,
kPreferencesPrivate,
kPrincipalsPrivate,
kDeleted_PrincipalsPrivate,
kPrinterProvider,
kPrivacy,
kProcesses,
......
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