Commit 6a4346b2 authored by jiangj's avatar jiangj Committed by Commit bot

Do not use hardcoded identifier in password manager user authorization

password_manager_util_mac uses hardcoded "com.google.Chrome", since rest of the
code is pretty generic we would like to use this file directly in Opera, however
we want to use something like com.operasoftware.Opera, since that information is
can already be retrieved from [base::mac::MainBundle() bundleIdentifier] we can
just use it and append ".show-passwords".

BUG=447344

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

Cr-Commit-Position: refs/heads/master@{#317037}
parent 762caab5
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/mac/authorization_util.h" #include "base/mac/authorization_util.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/mac/scoped_authorizationref.h" #include "base/mac/scoped_authorizationref.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
...@@ -18,8 +19,11 @@ ...@@ -18,8 +19,11 @@
namespace password_manager_util { namespace password_manager_util {
bool AuthenticateUser(gfx::NativeWindow window) { bool AuthenticateUser(gfx::NativeWindow window) {
NSString* identifier = [base::mac::MainBundle() bundleIdentifier];
AuthorizationString name =
[[identifier stringByAppendingString:@".show-passwords"] UTF8String];
AuthorizationItem right_items[] = { AuthorizationItem right_items[] = {
{"com.google.Chrome.show-passwords", 0, NULL, 0} {name, 0, NULL, 0}
}; };
AuthorizationRights rights = {arraysize(right_items), right_items}; AuthorizationRights rights = {arraysize(right_items), right_items};
......
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