OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/options/easy_unlock_handler.h" | 5 #include "chrome/browser/ui/webui/options/easy_unlock_handler.h" |
6 | 6 |
| 7 #include <string> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/values.h" | 10 #include "base/values.h" |
9 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/signin/easy_unlock_service.h" | 12 #include "chrome/browser/signin/easy_unlock_service.h" |
11 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
12 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
13 | 15 |
14 namespace options { | 16 namespace options { |
15 | 17 |
16 EasyUnlockHandler::EasyUnlockHandler() { | 18 EasyUnlockHandler::EasyUnlockHandler() { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 base::Unretained(this))); | 62 base::Unretained(this))); |
61 } | 63 } |
62 | 64 |
63 void EasyUnlockHandler::OnTurnOffOperationStatusChanged() { | 65 void EasyUnlockHandler::OnTurnOffOperationStatusChanged() { |
64 SendTurnOffOperationStatus(); | 66 SendTurnOffOperationStatus(); |
65 } | 67 } |
66 | 68 |
67 void EasyUnlockHandler::SendTurnOffOperationStatus() { | 69 void EasyUnlockHandler::SendTurnOffOperationStatus() { |
68 EasyUnlockService::TurnOffFlowStatus status = | 70 EasyUnlockService::TurnOffFlowStatus status = |
69 EasyUnlockService::Get(Profile::FromWebUI(web_ui())) | 71 EasyUnlockService::Get(Profile::FromWebUI(web_ui())) |
70 ->turn_off_flow_status(); | 72 ->GetTurnOffFlowStatus(); |
71 | 73 |
72 // Translate status into JS UI state string. Note the translated string | 74 // Translate status into JS UI state string. Note the translated string |
73 // should match UIState defined in easy_unlock_turn_off_overlay.js. | 75 // should match UIState defined in easy_unlock_turn_off_overlay.js. |
74 std::string status_string; | 76 std::string status_string; |
75 switch (status) { | 77 switch (status) { |
76 case EasyUnlockService::IDLE: | 78 case EasyUnlockService::IDLE: |
77 status_string = "idle"; | 79 status_string = "idle"; |
78 break; | 80 break; |
79 case EasyUnlockService::PENDING: | 81 case EasyUnlockService::PENDING: |
80 status_string = "pending"; | 82 status_string = "pending"; |
(...skipping 17 matching lines...) Expand all Loading... |
98 | 100 |
99 void EasyUnlockHandler::HandleRequestTurnOff(const base::ListValue* args) { | 101 void EasyUnlockHandler::HandleRequestTurnOff(const base::ListValue* args) { |
100 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->RunTurnOffFlow(); | 102 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->RunTurnOffFlow(); |
101 } | 103 } |
102 | 104 |
103 void EasyUnlockHandler::HandlePageDismissed(const base::ListValue* args) { | 105 void EasyUnlockHandler::HandlePageDismissed(const base::ListValue* args) { |
104 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->ResetTurnOffFlow(); | 106 EasyUnlockService::Get(Profile::FromWebUI(web_ui()))->ResetTurnOffFlow(); |
105 } | 107 } |
106 | 108 |
107 } // namespace options | 109 } // namespace options |
OLD | NEW |