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

Unified Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 2436903003: Extract ArcSupportMessageHost. (Closed)
Patch Set: Fix tests Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/arc_auth_service.cc
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc
index a5e680699ccbe8b9f55c2b1aa7be7e9d142f4d2a..d448581e753b29cdccfce18d970397f324f876e3 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -469,6 +469,7 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
}
profile_ = profile;
+ support_host_.reset(new ArcSupportHost());
khmel 2016/10/21 03:34:49 I would recommend to create it on demand. In most
hidehiko 2016/10/21 07:40:27 Ah, yes it can be in theory, but the current code
khmel 2016/10/24 15:05:36 Took another look. arc_support_host is not trivial
hidehiko 2016/10/24 19:00:58 I agree that observing pref can be wasteful, but i
SetState(State::STOPPED);
PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver(
@@ -550,7 +551,6 @@ void ArcAuthService::ShowUI(UIPage page, const base::string16& status) {
ArcSupportHost::kHostAppId);
CHECK(extension && extensions::util::IsAppLaunchable(
ArcSupportHost::kHostAppId, profile_));
-
OpenApplication(CreateAppLaunchParamsUserContainer(
profile_, extension, WindowOpenDisposition::NEW_WINDOW,
extensions::SOURCE_CHROME_INTERNAL));
@@ -667,8 +667,8 @@ void ArcAuthService::RemoveObserver(Observer* observer) {
void ArcAuthService::CloseUI() {
ui_page_ = UIPage::NO_PAGE;
ui_page_status_.clear();
- for (auto& observer : observer_list_)
- observer.OnOptInUIClose();
+ if (support_host_)
+ support_host_->Close();
if (!g_disable_ui_for_testing)
ArcAuthNotification::Hide();
}
@@ -676,8 +676,8 @@ void ArcAuthService::CloseUI() {
void ArcAuthService::SetUIPage(UIPage page, const base::string16& status) {
ui_page_ = page;
ui_page_status_ = status;
- for (auto& observer : observer_list_)
- observer.OnOptInUIShowPage(ui_page_, ui_page_status_);
+ if (support_host_)
khmel 2016/10/21 03:34:49 In my previous comment I recommend to create host
hidehiko 2016/10/21 07:40:27 Unfortunately, it cannot, specifically for CloseUI
khmel 2016/10/24 15:05:36 Acknowledged, however it would be nice to have LOG
hidehiko 2016/10/24 19:00:58 Adding log makes sense. But, as I said, it is not
+ support_host_->ShowPage(ui_page_, ui_page_status_);
}
// This is the special method to support enterprise mojo API.

Powered by Google App Engine
This is Rietveld 408576698