Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/extensions/extension_chrome_auth_private_api.cc

Issue 10796062: Moving chrome_auth_private to c/b/extensions/api (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/extension_chrome_auth_private_api.h"
6
7 #include <string>
8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
11 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory. h"
12 #include "chrome/browser/profiles/profile.h"
13
14 namespace {
15
16 bool test_mode = false;
17
18 } // namespace
19
20 SetCloudPrintCredentialsFunction::SetCloudPrintCredentialsFunction() {
21 }
22
23 SetCloudPrintCredentialsFunction::~SetCloudPrintCredentialsFunction() {
24 }
25
26 bool SetCloudPrintCredentialsFunction::RunImpl() {
27 std::string user_email;
28 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &user_email));
29 std::string robot_email;
30 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &robot_email));
31 std::string credentials;
32 EXTENSION_FUNCTION_VALIDATE(args_->GetString(2, &credentials));
33 if (test_mode) {
34 std::string test_response = user_email;
35 test_response.append(robot_email);
36 test_response.append(credentials);
37 SetResult(Value::CreateStringValue(test_response));
38 } else {
39 CloudPrintProxyServiceFactory::GetForProfile(profile_)->
40 EnableForUserWithRobot(credentials, robot_email, user_email);
41 }
42 SendResponse(true);
43 return true;
44 }
45
46 // static
47 void SetCloudPrintCredentialsFunction::SetTestMode(bool test_mode_enabled) {
48 test_mode = test_mode_enabled;
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698