Chromium Code Reviews| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 | 212 |
| 213 void ArcSupportHost::ShowPage(UIPage ui_page) { | 213 void ArcSupportHost::ShowPage(UIPage ui_page) { |
| 214 ui_page_ = ui_page; | 214 ui_page_ = ui_page; |
| 215 if (!message_host_) { | 215 if (!message_host_) { |
| 216 if (app_start_pending_) { | 216 if (app_start_pending_) { |
| 217 VLOG(2) << "ArcSupportHost::ShowPage(" << ui_page << ") is called " | 217 VLOG(2) << "ArcSupportHost::ShowPage(" << ui_page << ") is called " |
| 218 << "before connection to ARC support Chrome app has finished " | 218 << "before connection to ARC support Chrome app has finished " |
| 219 << "establishing."; | 219 << "establishing."; |
| 220 return; | 220 return; |
| 221 } | 221 } |
| 222 RequestAppStart(); | 222 |
| 223 if (!silent_mode_ || ui_page != UIPage::ARC_LOADING) | |
| 224 RequestAppStart(); | |
| 225 else | |
| 226 VLOG(2) << "Skip showing Arc loading progess due in silent mode."; | |
| 227 | |
| 223 return; | 228 return; |
| 224 } | 229 } |
| 225 | 230 |
| 226 base::DictionaryValue message; | 231 base::DictionaryValue message; |
| 227 message.SetString(kAction, kActionShowPage); | 232 message.SetString(kAction, kActionShowPage); |
| 228 switch (ui_page) { | 233 switch (ui_page) { |
| 229 case UIPage::TERMS: | 234 case UIPage::TERMS: |
| 230 message.SetString(kPage, "terms"); | 235 message.SetString(kPage, "terms"); |
| 231 break; | 236 break; |
| 232 case UIPage::LSO: | 237 case UIPage::LSO: |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 display::Screen* screen = display::Screen::GetScreen(); | 379 display::Screen* screen = display::Screen::GetScreen(); |
| 375 if (screen) | 380 if (screen) |
| 376 screen->RemoveObserver(this); | 381 screen->RemoveObserver(this); |
| 377 message_host_->SetObserver(nullptr); | 382 message_host_->SetObserver(nullptr); |
| 378 message_host_ = nullptr; | 383 message_host_ = nullptr; |
| 379 } | 384 } |
| 380 | 385 |
| 381 void ArcSupportHost::RequestAppStart() { | 386 void ArcSupportHost::RequestAppStart() { |
| 382 DCHECK(!message_host_); | 387 DCHECK(!message_host_); |
| 383 DCHECK(!app_start_pending_); | 388 DCHECK(!app_start_pending_); |
| 384 | 389 silent_mode_ = false; |
| 385 app_start_pending_ = true; | 390 app_start_pending_ = true; |
| 386 request_open_app_callback_.Run(profile_); | 391 request_open_app_callback_.Run(profile_); |
| 387 } | 392 } |
| 388 | 393 |
| 389 void ArcSupportHost::SetRequestOpenAppCallbackForTesting( | 394 void ArcSupportHost::SetRequestOpenAppCallbackForTesting( |
| 390 const RequestOpenAppCallback& callback) { | 395 const RequestOpenAppCallback& callback) { |
| 391 DCHECK(!message_host_); | 396 DCHECK(!message_host_); |
| 392 DCHECK(!app_start_pending_); | 397 DCHECK(!app_start_pending_); |
| 393 DCHECK(!callback.is_null()); | 398 DCHECK(!callback.is_null()); |
| 394 request_open_app_callback_ = callback; | 399 request_open_app_callback_ = callback; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 message.Set(kData, std::move(loadtime_data)); | 489 message.Set(kData, std::move(loadtime_data)); |
| 485 | 490 |
| 486 const std::string device_id = user_manager::known_user::GetDeviceId( | 491 const std::string device_id = user_manager::known_user::GetDeviceId( |
| 487 multi_user_util::GetAccountIdFromProfile(profile_)); | 492 multi_user_util::GetAccountIdFromProfile(profile_)); |
| 488 message.SetString(kDeviceId, device_id); | 493 message.SetString(kDeviceId, device_id); |
| 489 | 494 |
| 490 message_host_->SendMessage(message); | 495 message_host_->SendMessage(message); |
| 491 return true; | 496 return true; |
| 492 } | 497 } |
| 493 | 498 |
| 499 void ArcSupportHost::SetSilentMode() { | |
| 500 if (message_host_) { | |
| 501 // In case of managed Arc, UI is started OnPrimaryProfilePrepared which | |
|
xiyuan
2016/12/08 20:27:28
nit: OnPrimaryProfilePrepared -> OnPrimary*User*Pr
khmel
2016/12/08 23:33:45
Done.
| |
| 502 // happens earlier than user processes Arc OOBE page. Close UI manually in | |
| 503 // this case. | |
| 504 DCHECK(ui_page_ == UIPage::ARC_LOADING || ui_page_ == UIPage::TERMS); | |
| 505 Close(); | |
|
xiyuan
2016/12/08 20:27:28
Is it possible to not open the UI at all instead o
khmel
2016/12/08 23:33:45
Yes, not opening is preferred. However found yet a
| |
| 506 } | |
| 507 silent_mode_ = true; | |
| 508 } | |
| 509 | |
| 494 void ArcSupportHost::OnDisplayAdded(const display::Display& new_display) {} | 510 void ArcSupportHost::OnDisplayAdded(const display::Display& new_display) {} |
| 495 | 511 |
| 496 void ArcSupportHost::OnDisplayRemoved(const display::Display& old_display) {} | 512 void ArcSupportHost::OnDisplayRemoved(const display::Display& old_display) {} |
| 497 | 513 |
| 498 void ArcSupportHost::OnDisplayMetricsChanged(const display::Display& display, | 514 void ArcSupportHost::OnDisplayMetricsChanged(const display::Display& display, |
| 499 uint32_t changed_metrics) { | 515 uint32_t changed_metrics) { |
| 500 if (!message_host_) | 516 if (!message_host_) |
| 501 return; | 517 return; |
| 502 | 518 |
| 503 base::DictionaryValue message; | 519 base::DictionaryValue message; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 for (auto& observer : observer_list_) | 559 for (auto& observer : observer_list_) |
| 544 observer.OnRetryClicked(); | 560 observer.OnRetryClicked(); |
| 545 } else if (event == kEventOnSendFeedbackClicked) { | 561 } else if (event == kEventOnSendFeedbackClicked) { |
| 546 for (auto& observer : observer_list_) | 562 for (auto& observer : observer_list_) |
| 547 observer.OnSendFeedbackClicked(); | 563 observer.OnSendFeedbackClicked(); |
| 548 } else { | 564 } else { |
| 549 LOG(ERROR) << "Unknown message: " << event; | 565 LOG(ERROR) << "Unknown message: " << event; |
| 550 NOTREACHED(); | 566 NOTREACHED(); |
| 551 } | 567 } |
| 552 } | 568 } |
| OLD | NEW |