| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/arc/arc_support_host.h" | 5 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/system/chromeos/devicetype_utils.h" | 10 #include "ash/common/system/chromeos/devicetype_utils.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 constexpr char kEvent[] = "event"; | 60 constexpr char kEvent[] = "event"; |
| 61 | 61 |
| 62 // "onWindowClosed" is fired when the extension window is closed. | 62 // "onWindowClosed" is fired when the extension window is closed. |
| 63 // No data will be provided. | 63 // No data will be provided. |
| 64 constexpr char kEventOnWindowClosed[] = "onWindowClosed"; | 64 constexpr char kEventOnWindowClosed[] = "onWindowClosed"; |
| 65 | 65 |
| 66 // "onAuthSucceeded" is fired when successfully done to LSO authorization in | 66 // "onAuthSucceeded" is fired when successfully done to LSO authorization in |
| 67 // extension. | 67 // extension. |
| 68 // The auth token is passed via "code" field. | 68 // The auth token is passed via "code" field. |
| 69 constexpr char kEventOnAuthSucceeded[] = "onAuthSucceeded"; | 69 constexpr char kEventOnAuthSucceeded[] = "onAuthSucceeded"; |
| 70 // "onAuthFailed" is fired when LSO authorization has failed in extension. |
| 71 constexpr char kEventOnAuthFailed[] = "onAuthFailed"; |
| 70 constexpr char kCode[] = "code"; | 72 constexpr char kCode[] = "code"; |
| 71 | 73 |
| 72 // "onAgree" is fired when a user clicks "Agree" button. | 74 // "onAgree" is fired when a user clicks "Agree" button. |
| 73 // The message should have the following three fields: | 75 // The message should have the following three fields: |
| 74 // - isMetricsEnabled | 76 // - isMetricsEnabled |
| 75 // - isBackupRestoreEnabled | 77 // - isBackupRestoreEnabled |
| 76 // - isLocationServiceEnabled | 78 // - isLocationServiceEnabled |
| 77 constexpr char kEventOnAgreed[] = "onAgreed"; | 79 constexpr char kEventOnAgreed[] = "onAgreed"; |
| 78 constexpr char kIsMetricsEnabled[] = "isMetricsEnabled"; | 80 constexpr char kIsMetricsEnabled[] = "isMetricsEnabled"; |
| 79 constexpr char kIsBackupRestoreEnabled[] = "isBackupRestoreEnabled"; | 81 constexpr char kIsBackupRestoreEnabled[] = "isBackupRestoreEnabled"; |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 for (auto& observer : observer_list_) | 497 for (auto& observer : observer_list_) |
| 496 observer.OnWindowClosed(); | 498 observer.OnWindowClosed(); |
| 497 } else if (event == kEventOnAuthSucceeded) { | 499 } else if (event == kEventOnAuthSucceeded) { |
| 498 std::string code; | 500 std::string code; |
| 499 if (message.GetString(kCode, &code)) { | 501 if (message.GetString(kCode, &code)) { |
| 500 for (auto& observer : observer_list_) | 502 for (auto& observer : observer_list_) |
| 501 observer.OnAuthSucceeded(code); | 503 observer.OnAuthSucceeded(code); |
| 502 } else { | 504 } else { |
| 503 NOTREACHED(); | 505 NOTREACHED(); |
| 504 } | 506 } |
| 507 } else if (event == kEventOnAuthFailed) { |
| 508 for (auto& observer : observer_list_) |
| 509 observer.OnAuthFailed(); |
| 505 } else if (event == kEventOnAgreed) { | 510 } else if (event == kEventOnAgreed) { |
| 506 bool is_metrics_enabled; | 511 bool is_metrics_enabled; |
| 507 bool is_backup_restore_enabled; | 512 bool is_backup_restore_enabled; |
| 508 bool is_location_service_enabled; | 513 bool is_location_service_enabled; |
| 509 if (message.GetBoolean(kIsMetricsEnabled, &is_metrics_enabled) && | 514 if (message.GetBoolean(kIsMetricsEnabled, &is_metrics_enabled) && |
| 510 message.GetBoolean(kIsBackupRestoreEnabled, | 515 message.GetBoolean(kIsBackupRestoreEnabled, |
| 511 &is_backup_restore_enabled) && | 516 &is_backup_restore_enabled) && |
| 512 message.GetBoolean(kIsLocationServiceEnabled, | 517 message.GetBoolean(kIsLocationServiceEnabled, |
| 513 &is_location_service_enabled)) { | 518 &is_location_service_enabled)) { |
| 514 for (auto& observer : observer_list_) { | 519 for (auto& observer : observer_list_) { |
| 515 observer.OnTermsAgreed(is_metrics_enabled, is_backup_restore_enabled, | 520 observer.OnTermsAgreed(is_metrics_enabled, is_backup_restore_enabled, |
| 516 is_location_service_enabled); | 521 is_location_service_enabled); |
| 517 } | 522 } |
| 518 } else { | 523 } else { |
| 519 NOTREACHED(); | 524 NOTREACHED(); |
| 520 } | 525 } |
| 521 } else if (event == kEventOnRetryClicked) { | 526 } else if (event == kEventOnRetryClicked) { |
| 522 for (auto& observer : observer_list_) | 527 for (auto& observer : observer_list_) |
| 523 observer.OnRetryClicked(); | 528 observer.OnRetryClicked(); |
| 524 } else if (event == kEventOnSendFeedbackClicked) { | 529 } else if (event == kEventOnSendFeedbackClicked) { |
| 525 for (auto& observer : observer_list_) | 530 for (auto& observer : observer_list_) |
| 526 observer.OnSendFeedbackClicked(); | 531 observer.OnSendFeedbackClicked(); |
| 527 } else { | 532 } else { |
| 528 LOG(ERROR) << "Unknown message: " << event; | 533 LOG(ERROR) << "Unknown message: " << event; |
| 529 NOTREACHED(); | 534 NOTREACHED(); |
| 530 } | 535 } |
| 531 } | 536 } |
| OLD | NEW |