| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 70 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 71 html_bytes->data.resize(response.size()); | 71 html_bytes->data.resize(response.size()); |
| 72 std::copy(response.begin(), response.end(), html_bytes->data.begin()); | 72 std::copy(response.begin(), response.end(), html_bytes->data.begin()); |
| 73 SendResponse(request_id, html_bytes); | 73 SendResponse(request_id, html_bytes); |
| 74 } | 74 } |
| 75 | 75 |
| 76 class BrowserSigninHtml : public HtmlDialogUIDelegate, | 76 class BrowserSigninHtml : public HtmlDialogUIDelegate, |
| 77 public WebUIMessageHandler { | 77 public WebUIMessageHandler { |
| 78 public: | 78 public: |
| 79 BrowserSigninHtml(BrowserSignin* signin, | 79 BrowserSigninHtml(BrowserSignin* signin, |
| 80 string16 suggested_email, | 80 const string16& suggested_email, |
| 81 string16 login_message); | 81 const string16& login_message); |
| 82 virtual ~BrowserSigninHtml() {} | 82 virtual ~BrowserSigninHtml() {} |
| 83 | 83 |
| 84 // HtmlDialogUIDelegate implementation | 84 // HtmlDialogUIDelegate implementation |
| 85 virtual bool IsDialogModal() const { | 85 virtual bool IsDialogModal() const { |
| 86 return false; | 86 return false; |
| 87 }; | 87 }; |
| 88 virtual std::wstring GetDialogTitle() const { | 88 virtual std::wstring GetDialogTitle() const { |
| 89 return L""; | 89 return L""; |
| 90 } | 90 } |
| 91 virtual GURL GetDialogContentURL() const { | 91 virtual GURL GetDialogContentURL() const { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Nonowned pointer; |signin_| owns this object. | 128 // Nonowned pointer; |signin_| owns this object. |
| 129 BrowserSignin* signin_; | 129 BrowserSignin* signin_; |
| 130 | 130 |
| 131 string16 suggested_email_; | 131 string16 suggested_email_; |
| 132 string16 login_message_; | 132 string16 login_message_; |
| 133 | 133 |
| 134 bool closed_; | 134 bool closed_; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 BrowserSigninHtml::BrowserSigninHtml(BrowserSignin* signin, | 137 BrowserSigninHtml::BrowserSigninHtml(BrowserSignin* signin, |
| 138 string16 suggested_email, | 138 const string16& suggested_email, |
| 139 string16 login_message) | 139 const string16& login_message) |
| 140 : signin_(signin), | 140 : signin_(signin), |
| 141 suggested_email_(suggested_email), | 141 suggested_email_(suggested_email), |
| 142 login_message_(login_message), | 142 login_message_(login_message), |
| 143 closed_(false) { | 143 closed_(false) { |
| 144 } | 144 } |
| 145 | 145 |
| 146 void BrowserSigninHtml::RegisterMessages() { | 146 void BrowserSigninHtml::RegisterMessages() { |
| 147 web_ui_->RegisterMessageCallback( | 147 web_ui_->RegisterMessageCallback( |
| 148 "SubmitAuth", NewCallback(this, &BrowserSigninHtml::HandleSubmitAuth)); | 148 "SubmitAuth", NewCallback(this, &BrowserSigninHtml::HandleSubmitAuth)); |
| 149 web_ui_->RegisterMessageCallback( | 149 web_ui_->RegisterMessageCallback( |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 void BrowserSignin::ShowSigninTabModal(TabContents* tab_contents) { | 327 void BrowserSignin::ShowSigninTabModal(TabContents* tab_contents) { |
| 328 // TODO(johnnyg): Need a linux views implementation for ConstrainedHtmlDialog. | 328 // TODO(johnnyg): Need a linux views implementation for ConstrainedHtmlDialog. |
| 329 #if defined(OS_WIN) || defined(OS_CHROMEOS) || !defined(TOOLKIT_VIEWS) | 329 #if defined(OS_WIN) || defined(OS_CHROMEOS) || !defined(TOOLKIT_VIEWS) |
| 330 html_dialog_ui_delegate_ = CreateHtmlDialogUI(); | 330 html_dialog_ui_delegate_ = CreateHtmlDialogUI(); |
| 331 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile_, | 331 ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile_, |
| 332 html_dialog_ui_delegate_, | 332 html_dialog_ui_delegate_, |
| 333 tab_contents); | 333 tab_contents); |
| 334 #endif | 334 #endif |
| 335 } | 335 } |
| OLD | NEW |