OLD | NEW |
---|---|
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/options/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.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/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/google/google_util.h" | 10 #include "chrome/browser/google/google_util.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/sync/profile_sync_service.h" | 12 #include "chrome/browser/sync/profile_sync_service.h" |
13 #include "chrome/browser/sync/sync_setup_flow.h" | 13 #include "chrome/browser/sync/sync_setup_flow.h" |
14 #include "chrome/browser/ui/browser_list.h" | |
14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
15 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
16 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
18 #include "grit/locale_settings.h" | 19 #include "grit/locale_settings.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
20 | 21 |
21 using l10n_util::GetStringFUTF16; | 22 using l10n_util::GetStringFUTF16; |
22 using l10n_util::GetStringUTF16; | 23 using l10n_util::GetStringUTF16; |
23 | 24 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 } | 326 } |
326 | 327 |
327 void SyncSetupHandler::SetFlow(SyncSetupFlow* flow) { | 328 void SyncSetupHandler::SetFlow(SyncSetupFlow* flow) { |
328 flow_ = flow; | 329 flow_ = flow; |
329 } | 330 } |
330 | 331 |
331 void SyncSetupHandler::Focus() { | 332 void SyncSetupHandler::Focus() { |
332 static_cast<RenderViewHostDelegate*>(web_ui_->tab_contents())->Activate(); | 333 static_cast<RenderViewHostDelegate*>(web_ui_->tab_contents())->Activate(); |
333 } | 334 } |
334 | 335 |
336 void SyncSetupHandler::ShowSyncSetup(Profile* profile) { | |
Andrew T Wilson (Slow)
2011/07/11 18:12:51
When you get rid of the Profile* parameter, you ca
| |
337 BrowserList::GetLastActiveWithProfile(profile)->ShowOptionsTab( | |
338 chrome::kSyncSetupSubPage); | |
Andrew T Wilson (Slow)
2011/07/11 18:12:51
csilv: Do we need to do anything else here to avoi
qsr (NOT THE RIGHT qsr)
2011/07/12 07:01:37
Right now, I'm pretty sure I didn't change the beh
| |
339 } | |
340 | |
335 void SyncSetupHandler::OnDidClosePage(const ListValue* args) { | 341 void SyncSetupHandler::OnDidClosePage(const ListValue* args) { |
336 if (flow_) { | 342 if (flow_) { |
337 flow_->OnDialogClosed(std::string()); | 343 flow_->OnDialogClosed(std::string()); |
338 flow_ = NULL; | 344 flow_ = NULL; |
339 } | 345 } |
340 } | 346 } |
341 | 347 |
342 void SyncSetupHandler::HandleSubmitAuth(const ListValue* args) { | 348 void SyncSetupHandler::HandleSubmitAuth(const ListValue* args) { |
343 std::string json; | 349 std::string json; |
344 if (!args->GetString(0, &json)) { | 350 if (!args->GetString(0, &json)) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 // either a login or a configure flow based on the state of sync. | 476 // either a login or a configure flow based on the state of sync. |
471 if (service->HasSyncSetupCompleted()) | 477 if (service->HasSyncSetupCompleted()) |
472 service->get_wizard().Step(SyncSetupWizard::CONFIGURE); | 478 service->get_wizard().Step(SyncSetupWizard::CONFIGURE); |
473 else | 479 else |
474 service->get_wizard().Step(SyncSetupWizard::GAIA_LOGIN); | 480 service->get_wizard().Step(SyncSetupWizard::GAIA_LOGIN); |
475 | 481 |
476 // Show the Sync Setup page. | 482 // Show the Sync Setup page. |
477 scoped_ptr<Value> page(Value::CreateStringValue("syncSetup")); | 483 scoped_ptr<Value> page(Value::CreateStringValue("syncSetup")); |
478 web_ui_->CallJavascriptFunction("OptionsPage.navigateToPage", *page); | 484 web_ui_->CallJavascriptFunction("OptionsPage.navigateToPage", *page); |
479 } | 485 } |
OLD | NEW |