| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 constexpr char kEvent[] = "event"; | 62 constexpr char kEvent[] = "event"; |
| 63 | 63 |
| 64 // "onWindowClosed" is fired when the extension window is closed. | 64 // "onWindowClosed" is fired when the extension window is closed. |
| 65 // No data will be provided. | 65 // No data will be provided. |
| 66 constexpr char kEventOnWindowClosed[] = "onWindowClosed"; | 66 constexpr char kEventOnWindowClosed[] = "onWindowClosed"; |
| 67 | 67 |
| 68 // "onAuthSucceeded" is fired when successfully done to LSO authorization in | 68 // "onAuthSucceeded" is fired when successfully done to LSO authorization in |
| 69 // extension. | 69 // extension. |
| 70 // The auth token is passed via "code" field. | 70 // The auth token is passed via "code" field. |
| 71 constexpr char kEventOnAuthSucceeded[] = "onAuthSucceeded"; | 71 constexpr char kEventOnAuthSucceeded[] = "onAuthSucceeded"; |
| 72 // "onAuthFailed" is fired when LSO authorization has failed in extension. |
| 73 constexpr char kEventOnAuthFailed[] = "onAuthFailed"; |
| 72 constexpr char kCode[] = "code"; | 74 constexpr char kCode[] = "code"; |
| 73 | 75 |
| 74 // "onAgree" is fired when a user clicks "Agree" button. | 76 // "onAgree" is fired when a user clicks "Agree" button. |
| 75 // The message should have the following three fields: | 77 // The message should have the following three fields: |
| 76 // - isMetricsEnabled | 78 // - isMetricsEnabled |
| 77 // - isBackupRestoreEnabled | 79 // - isBackupRestoreEnabled |
| 78 // - isLocationServiceEnabled | 80 // - isLocationServiceEnabled |
| 79 constexpr char kEventOnAgreed[] = "onAgreed"; | 81 constexpr char kEventOnAgreed[] = "onAgreed"; |
| 80 constexpr char kIsMetricsEnabled[] = "isMetricsEnabled"; | 82 constexpr char kIsMetricsEnabled[] = "isMetricsEnabled"; |
| 81 constexpr char kIsBackupRestoreEnabled[] = "isBackupRestoreEnabled"; | 83 constexpr char kIsBackupRestoreEnabled[] = "isBackupRestoreEnabled"; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 for (auto& observer : observer_list_) | 519 for (auto& observer : observer_list_) |
| 518 observer.OnWindowClosed(); | 520 observer.OnWindowClosed(); |
| 519 } else if (event == kEventOnAuthSucceeded) { | 521 } else if (event == kEventOnAuthSucceeded) { |
| 520 std::string code; | 522 std::string code; |
| 521 if (message.GetString(kCode, &code)) { | 523 if (message.GetString(kCode, &code)) { |
| 522 for (auto& observer : observer_list_) | 524 for (auto& observer : observer_list_) |
| 523 observer.OnAuthSucceeded(code); | 525 observer.OnAuthSucceeded(code); |
| 524 } else { | 526 } else { |
| 525 NOTREACHED(); | 527 NOTREACHED(); |
| 526 } | 528 } |
| 529 } else if (event == kEventOnAuthFailed) { |
| 530 for (auto& observer : observer_list_) |
| 531 observer.OnAuthFailed(); |
| 527 } else if (event == kEventOnAgreed) { | 532 } else if (event == kEventOnAgreed) { |
| 528 bool is_metrics_enabled; | 533 bool is_metrics_enabled; |
| 529 bool is_backup_restore_enabled; | 534 bool is_backup_restore_enabled; |
| 530 bool is_location_service_enabled; | 535 bool is_location_service_enabled; |
| 531 if (message.GetBoolean(kIsMetricsEnabled, &is_metrics_enabled) && | 536 if (message.GetBoolean(kIsMetricsEnabled, &is_metrics_enabled) && |
| 532 message.GetBoolean(kIsBackupRestoreEnabled, | 537 message.GetBoolean(kIsBackupRestoreEnabled, |
| 533 &is_backup_restore_enabled) && | 538 &is_backup_restore_enabled) && |
| 534 message.GetBoolean(kIsLocationServiceEnabled, | 539 message.GetBoolean(kIsLocationServiceEnabled, |
| 535 &is_location_service_enabled)) { | 540 &is_location_service_enabled)) { |
| 536 for (auto& observer : observer_list_) { | 541 for (auto& observer : observer_list_) { |
| 537 observer.OnTermsAgreed(is_metrics_enabled, is_backup_restore_enabled, | 542 observer.OnTermsAgreed(is_metrics_enabled, is_backup_restore_enabled, |
| 538 is_location_service_enabled); | 543 is_location_service_enabled); |
| 539 } | 544 } |
| 540 } else { | 545 } else { |
| 541 NOTREACHED(); | 546 NOTREACHED(); |
| 542 } | 547 } |
| 543 } else if (event == kEventOnRetryClicked) { | 548 } else if (event == kEventOnRetryClicked) { |
| 544 for (auto& observer : observer_list_) | 549 for (auto& observer : observer_list_) |
| 545 observer.OnRetryClicked(); | 550 observer.OnRetryClicked(); |
| 546 } else if (event == kEventOnSendFeedbackClicked) { | 551 } else if (event == kEventOnSendFeedbackClicked) { |
| 547 for (auto& observer : observer_list_) | 552 for (auto& observer : observer_list_) |
| 548 observer.OnSendFeedbackClicked(); | 553 observer.OnSendFeedbackClicked(); |
| 549 } else { | 554 } else { |
| 550 LOG(ERROR) << "Unknown message: " << event; | 555 LOG(ERROR) << "Unknown message: " << event; |
| 551 NOTREACHED(); | 556 NOTREACHED(); |
| 552 } | 557 } |
| 553 } | 558 } |
| OLD | NEW |