Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #46 from darkdh/3398
Browse files Browse the repository at this point in the history
Create stub IdentityProvider
  • Loading branch information
bbondy committed Aug 25, 2016
2 parents 6750644 + 40ddc6f commit 54b28d9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
28 changes: 27 additions & 1 deletion atom/browser/autofill/atom_autofill_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/origin_util.h"
#include "google_apis/gaia/identity_provider.h"
#include "native_mate/dictionary.h"

DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::AtomAutofillClient);
Expand Down Expand Up @@ -52,6 +53,28 @@ struct Converter<autofill::Suggestion> {
};
} // namespace mate

class StubIdentityProvider : public IdentityProvider{
public:
StubIdentityProvider() {}
~StubIdentityProvider() override {}

std::string GetActiveUsername() override {
return std::string();
};

std::string GetActiveAccountId() override {
return std::string();
;}

OAuth2TokenService* GetTokenService() override {
return nullptr;
};

bool RequestLogin() override {
return false;
};
};

namespace autofill {

AtomAutofillClient::AtomAutofillClient(content::WebContents* web_contents)
Expand Down Expand Up @@ -96,7 +119,10 @@ sync_driver::SyncService* AtomAutofillClient::GetSyncService() {
}

IdentityProvider* AtomAutofillClient::GetIdentityProvider() {
return nullptr;
if (!identity_provider_) {
identity_provider_.reset(new StubIdentityProvider());
}
return identity_provider_.get();
}

rappor::RapporService* AtomAutofillClient::GetRapporService() {
Expand Down
4 changes: 4 additions & 0 deletions atom/browser/autofill/atom_autofill_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ namespace content {
class WebContents;
}

class IdentityProvider;

namespace autofill {

class FormStructure;
Expand Down Expand Up @@ -91,6 +93,8 @@ class AtomAutofillClient

base::WeakPtr<AutofillPopupDelegate> delegate_;

std::unique_ptr<IdentityProvider> identity_provider_;

DISALLOW_COPY_AND_ASSIGN(AtomAutofillClient);
};

Expand Down

0 comments on commit 54b28d9

Please sign in to comment.