| 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/browser_signin.h" | 5 #include "chrome/browser/browser_signin.h" |
| 6 | 6 |
| 7 #include <algorithm> | |
| 8 #include <string> | 7 #include <string> |
| 9 #include <vector> | 8 #include <vector> |
| 10 | 9 |
| 11 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| 12 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 13 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 14 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 15 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 16 #include "base/values.h" | 15 #include "base/values.h" |
| 17 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 std::string response; | 60 std::string response; |
| 62 if (path == kSigninPath) { | 61 if (path == kSigninPath) { |
| 63 const base::StringPiece html( | 62 const base::StringPiece html( |
| 64 ResourceBundle::GetSharedInstance().GetRawDataResource( | 63 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 65 IDR_SIGNIN_HTML)); | 64 IDR_SIGNIN_HTML)); |
| 66 DictionaryValue dict; | 65 DictionaryValue dict; |
| 67 SetFontAndTextDirection(&dict); | 66 SetFontAndTextDirection(&dict); |
| 68 response = jstemplate_builder::GetI18nTemplateHtml(html, &dict); | 67 response = jstemplate_builder::GetI18nTemplateHtml(html, &dict); |
| 69 } | 68 } |
| 70 | 69 |
| 71 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 70 SendResponse(request_id, base::RefCountedString::TakeString(&response)); |
| 72 html_bytes->data.resize(response.size()); | |
| 73 std::copy(response.begin(), response.end(), html_bytes->data.begin()); | |
| 74 SendResponse(request_id, html_bytes); | |
| 75 } | 71 } |
| 76 | 72 |
| 77 class BrowserSigninHtml : public HtmlDialogUIDelegate, | 73 class BrowserSigninHtml : public HtmlDialogUIDelegate, |
| 78 public WebUIMessageHandler { | 74 public WebUIMessageHandler { |
| 79 public: | 75 public: |
| 80 BrowserSigninHtml(BrowserSignin* signin, | 76 BrowserSigninHtml(BrowserSignin* signin, |
| 81 const string16& suggested_email, | 77 const string16& suggested_email, |
| 82 const string16& login_message); | 78 const string16& login_message); |
| 83 virtual ~BrowserSigninHtml() {} | 79 virtual ~BrowserSigninHtml() {} |
| 84 | 80 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 324 |
| 329 void BrowserSignin::ShowSigninTabModal(TabContents* tab_contents) { | 325 void BrowserSignin::ShowSigninTabModal(TabContents* tab_contents) { |
| 330 // TODO(johnnyg): Need a linux views implementation for ConstrainedHtmlDialog. | 326 // TODO(johnnyg): Need a linux views implementation for ConstrainedHtmlDialog. |
| 331 #if defined(OS_WIN) || defined(OS_CHROMEOS) || !defined(TOOLKIT_VIEWS) | 327 #if defined(OS_WIN) || defined(OS_CHROMEOS) || !defined(TOOLKIT_VIEWS) |
| 332 html_dialog_ui_delegate_ = CreateHtmlDialogUI(); | 328 html_dialog_ui_delegate_ = CreateHtmlDialogUI(); |
| 333 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile_, | 329 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile_, |
| 334 html_dialog_ui_delegate_, | 330 html_dialog_ui_delegate_, |
| 335 tab_contents); | 331 tab_contents); |
| 336 #endif | 332 #endif |
| 337 } | 333 } |
| OLD | NEW |