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

Side by Side Diff: chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc

Issue 6821075: Chrome-side lockbox bindings (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed Ken's nits. Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/chromeos/enterprise_enrollment_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (!GetController(this) || !(bindings_ & BindingsPolicy::WEB_UI)) 281 if (!GetController(this) || !(bindings_ & BindingsPolicy::WEB_UI))
282 return; 282 return;
283 283
284 WebUIMessageHandler* handler = new EnterpriseEnrollmentMessageHandler(); 284 WebUIMessageHandler* handler = new EnterpriseEnrollmentMessageHandler();
285 AddMessageHandler(handler->Attach(this)); 285 AddMessageHandler(handler->Attach(this));
286 286
287 // Set up the data source, so the enrollment page can be loaded. 287 // Set up the data source, so the enrollment page can be loaded.
288 tab_contents()->profile()->GetChromeURLDataManager()->AddDataSource( 288 tab_contents()->profile()->GetChromeURLDataManager()->AddDataSource(
289 new EnterpriseEnrollmentDataSource()); 289 new EnterpriseEnrollmentDataSource());
290 290
291 std::string user;
292 bool has_init_user = GetController(this)->GetInitialUser(&user);
293 if (!has_init_user)
294 user = "";
291 // Set the arguments for showing the gaia login page. 295 // Set the arguments for showing the gaia login page.
292 DictionaryValue args; 296 DictionaryValue args;
293 args.SetString("user", ""); 297 args.SetString("user", user);
294 args.SetInteger("error", 0); 298 args.SetInteger("error", 0);
295 args.SetBoolean("editable_user", true); 299 args.SetBoolean("editable_user", !has_init_user);
296 args.SetString("initialScreen", "login-screen"); 300 args.SetString("initialScreen", "login-screen");
297 std::string json_args; 301 std::string json_args;
298 base::JSONWriter::Write(&args, false, &json_args); 302 base::JSONWriter::Write(&args, false, &json_args);
299 render_view_host->SetWebUIProperty("dialogArguments", json_args); 303 render_view_host->SetWebUIProperty("dialogArguments", json_args);
300 } 304 }
301 305
302 // static 306 // static
303 EnterpriseEnrollmentUI::Controller* EnterpriseEnrollmentUI::GetController( 307 EnterpriseEnrollmentUI::Controller* EnterpriseEnrollmentUI::GetController(
304 WebUI* ui) { 308 WebUI* ui) {
305 Controller** controller = 309 Controller** controller =
306 g_enrollment_ui_controller_property.Get().GetProperty( 310 g_enrollment_ui_controller_property.Get().GetProperty(
307 ui->tab_contents()->property_bag()); 311 ui->tab_contents()->property_bag());
308 312
309 return controller ? *controller : NULL; 313 return controller ? *controller : NULL;
310 } 314 }
311 315
312 // static 316 // static
313 void EnterpriseEnrollmentUI::SetController( 317 void EnterpriseEnrollmentUI::SetController(
314 TabContents* contents, 318 TabContents* contents,
315 EnterpriseEnrollmentUI::Controller* controller) { 319 EnterpriseEnrollmentUI::Controller* controller) {
316 g_enrollment_ui_controller_property.Get().SetProperty( 320 g_enrollment_ui_controller_property.Get().SetProperty(
317 contents->property_bag(), 321 contents->property_bag(),
318 controller); 322 controller);
319 } 323 }
320 324
321 } // namespace chromeos 325 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698