diff options
author | maksymb@chromium.org <maksymb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-23 21:18:42 +0000 |
---|---|---|
committer | maksymb@chromium.org <maksymb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-23 21:18:42 +0000 |
commit | e13d870701987ec2bd3d2d584a06a524be16f46a (patch) | |
tree | 08d195db75a32f624ac0c86a0e9aebbbd87e81bd /cloud_print/gcp20/prototype/printer.cc | |
parent | 144c8e950add26b44467784568d0ca5387a1047d (diff) | |
download | chromium_src-e13d870701987ec2bd3d2d584a06a524be16f46a.zip chromium_src-e13d870701987ec2bd3d2d584a06a524be16f46a.tar.gz chromium_src-e13d870701987ec2bd3d2d584a06a524be16f46a.tar.bz2 |
Added HTTP-method (POST, GET) checking for Privet requests. Added IsRegistered() checking.
BUG=
Review URL: https://chromiumcodereview.appspot.com/19147003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213221 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cloud_print/gcp20/prototype/printer.cc')
-rw-r--r-- | cloud_print/gcp20/prototype/printer.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cloud_print/gcp20/prototype/printer.cc b/cloud_print/gcp20/prototype/printer.cc index aa6bcd5..04d3066 100644 --- a/cloud_print/gcp20/prototype/printer.cc +++ b/cloud_print/gcp20/prototype/printer.cc @@ -174,6 +174,10 @@ bool Printer::CheckXPrivetTokenHeader(const std::string& token) const { return xtoken_.CheckValidXToken(token); } +bool Printer::IsRegistered() const { + return reg_info_.state == RegistrationInfo::DEV_REG_REGISTERED; +} + PrivetHttpServer::RegistrationErrorStatus Printer::RegistrationGetClaimToken( const std::string& user, std::string* token, @@ -290,8 +294,7 @@ void Printer::OnRegistrationError(const std::string& description) { PrivetHttpServer::RegistrationErrorStatus Printer::CheckCommonRegErrors( const std::string& user) const { - if (reg_info_.state == RegistrationInfo::DEV_REG_REGISTERED) - return PrivetHttpServer::REG_ERROR_REGISTERED; + DCHECK(!IsRegistered()); if (reg_info_.state != RegistrationInfo::DEV_REG_UNREGISTERED && user != reg_info_.user) { @@ -324,7 +327,7 @@ std::vector<std::string> Printer::CreateTxt() const { void Printer::SaveToFile(const base::FilePath& file_path) const { base::DictionaryValue json; // TODO(maksymb): Get rid of in-place constants. - if (reg_info_.state == RegistrationInfo::DEV_REG_REGISTERED) { + if (IsRegistered()) { json.SetBoolean("registered", true); json.SetString("user", reg_info_.user); json.SetString("device_id", reg_info_.device_id); |