OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/automation/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/automation/automation_provider.h" | 8 #include "chrome/browser/automation/automation_provider.h" |
9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
10 #include "chrome/browser/chromeos/login/authentication_notification_details.h" | 10 #include "chrome/browser/chromeos/login/authentication_notification_details.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 OOBEWebuiReadyObserver::OOBEWebuiReadyObserver(AutomationProvider* automation) | 60 OOBEWebuiReadyObserver::OOBEWebuiReadyObserver(AutomationProvider* automation) |
61 : automation_(automation->AsWeakPtr()) { | 61 : automation_(automation->AsWeakPtr()) { |
62 if (WizardController::default_controller() && | 62 if (WizardController::default_controller() && |
63 WizardController::default_controller()->current_screen()) { | 63 WizardController::default_controller()->current_screen()) { |
64 OOBEWebuiReady(); | 64 OOBEWebuiReady(); |
65 } else { | 65 } else { |
66 registrar_.Add(this, chrome::NOTIFICATION_WIZARD_FIRST_SCREEN_SHOWN, | 66 registrar_.Add(this, chrome::NOTIFICATION_WIZARD_FIRST_SCREEN_SHOWN, |
67 content::NotificationService::AllSources()); | 67 content::NotificationService::AllSources()); |
68 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_IMAGES_LOADED, | 68 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_IMAGES_LOADED, |
69 content::NotificationService::AllSources()); | 69 content::NotificationService::AllSources()); |
70 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_READY, | 70 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_LOADED, |
71 content::NotificationService::AllSources()); | 71 content::NotificationService::AllSources()); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 void OOBEWebuiReadyObserver::Observe( | 75 void OOBEWebuiReadyObserver::Observe( |
76 int type, | 76 int type, |
77 const content::NotificationSource& source, | 77 const content::NotificationSource& source, |
78 const content::NotificationDetails& details) { | 78 const content::NotificationDetails& details) { |
79 DCHECK(type == chrome::NOTIFICATION_WIZARD_FIRST_SCREEN_SHOWN || | 79 DCHECK(type == chrome::NOTIFICATION_WIZARD_FIRST_SCREEN_SHOWN || |
80 type == chrome::NOTIFICATION_LOGIN_USER_IMAGES_LOADED || | 80 type == chrome::NOTIFICATION_LOGIN_USER_IMAGES_LOADED || |
81 type == chrome::NOTIFICATION_LOGIN_WEBUI_READY); | 81 type == chrome::NOTIFICATION_LOGIN_WEBUI_LOADED); |
82 OOBEWebuiReady(); | 82 OOBEWebuiReady(); |
83 } | 83 } |
84 | 84 |
85 void OOBEWebuiReadyObserver::OOBEWebuiReady() { | 85 void OOBEWebuiReadyObserver::OOBEWebuiReady() { |
86 if (automation_) | 86 if (automation_) |
87 automation_->OnOOBEWebuiReady(); | 87 automation_->OnOOBEWebuiReady(); |
88 delete this; | 88 delete this; |
89 } | 89 } |
90 | 90 |
91 LoginObserver::LoginObserver(chromeos::ExistingUserController* controller, | 91 LoginObserver::LoginObserver(chromeos::ExistingUserController* controller, |
(...skipping 28 matching lines...) Expand all Loading... |
120 } | 120 } |
121 | 121 |
122 WizardControllerObserver::WizardControllerObserver( | 122 WizardControllerObserver::WizardControllerObserver( |
123 WizardController* wizard_controller, | 123 WizardController* wizard_controller, |
124 AutomationProvider* automation, | 124 AutomationProvider* automation, |
125 IPC::Message* reply_message) | 125 IPC::Message* reply_message) |
126 : wizard_controller_(wizard_controller), | 126 : wizard_controller_(wizard_controller), |
127 automation_(automation->AsWeakPtr()), | 127 automation_(automation->AsWeakPtr()), |
128 reply_message_(reply_message) { | 128 reply_message_(reply_message) { |
129 wizard_controller_->AddObserver(this); | 129 wizard_controller_->AddObserver(this); |
130 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_READY, | 130 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_LOADED, |
131 content::NotificationService::AllSources()); | 131 content::NotificationService::AllSources()); |
132 } | 132 } |
133 | 133 |
134 WizardControllerObserver::~WizardControllerObserver() { | 134 WizardControllerObserver::~WizardControllerObserver() { |
135 wizard_controller_->RemoveObserver(this); | 135 wizard_controller_->RemoveObserver(this); |
136 } | 136 } |
137 | 137 |
138 void WizardControllerObserver::OnScreenChanged( | 138 void WizardControllerObserver::OnScreenChanged( |
139 chromeos::WizardScreen* next_screen) { | 139 chromeos::WizardScreen* next_screen) { |
140 std::string screen_name = next_screen->GetName(); | 140 std::string screen_name = next_screen->GetName(); |
141 if (screen_to_wait_for_.empty() || screen_to_wait_for_ == screen_name) { | 141 if (screen_to_wait_for_.empty() || screen_to_wait_for_ == screen_name) { |
142 SendReply(screen_name); | 142 SendReply(screen_name); |
143 } else { | 143 } else { |
144 DVLOG(2) << "Still waiting for " << screen_to_wait_for_; | 144 DVLOG(2) << "Still waiting for " << screen_to_wait_for_; |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 void WizardControllerObserver::OnSessionStart() { | 148 void WizardControllerObserver::OnSessionStart() { |
149 SendReply(kSessionScreenName); | 149 SendReply(kSessionScreenName); |
150 } | 150 } |
151 | 151 |
152 void WizardControllerObserver::Observe( | 152 void WizardControllerObserver::Observe( |
153 int type, | 153 int type, |
154 const content::NotificationSource& source, | 154 const content::NotificationSource& source, |
155 const content::NotificationDetails& details) { | 155 const content::NotificationDetails& details) { |
156 DCHECK(type == chrome::NOTIFICATION_LOGIN_WEBUI_READY); | 156 DCHECK(type == chrome::NOTIFICATION_LOGIN_WEBUI_LOADED); |
157 SendReply(WizardController::kLoginScreenName); | 157 SendReply(WizardController::kLoginScreenName); |
158 } | 158 } |
159 | 159 |
160 void WizardControllerObserver::SendReply(const std::string& screen_name) { | 160 void WizardControllerObserver::SendReply(const std::string& screen_name) { |
161 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 161 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
162 return_value->SetString("next_screen", screen_name); | 162 return_value->SetString("next_screen", screen_name); |
163 AutomationJSONReply(automation_, reply_message_.release()) | 163 AutomationJSONReply(automation_, reply_message_.release()) |
164 .SendSuccess(return_value.get()); | 164 .SendSuccess(return_value.get()); |
165 delete this; | 165 delete this; |
166 } | 166 } |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 519 |
520 void PhotoCaptureObserver::LocalStateChanged( | 520 void PhotoCaptureObserver::LocalStateChanged( |
521 chromeos::UserManager* user_manager) { | 521 chromeos::UserManager* user_manager) { |
522 user_manager->RemoveObserver(this); | 522 user_manager->RemoveObserver(this); |
523 if (automation_) { | 523 if (automation_) { |
524 AutomationJSONReply( | 524 AutomationJSONReply( |
525 automation_, reply_message_.release()).SendSuccess(NULL); | 525 automation_, reply_message_.release()).SendSuccess(NULL); |
526 } | 526 } |
527 delete this; | 527 delete this; |
528 } | 528 } |
OLD | NEW |