| 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/ui/webui/signin_internals_ui.h" | 5 #include "chrome/browser/ui/webui/signin_internals_ui.h" |
| 6 | 6 |
| 7 #include "base/hash.h" | 7 #include "base/hash.h" |
| 8 #include "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/about_signin_internals_factory.h" | 10 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| 11 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" | 11 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
| 12 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 13 #include "components/grit/components_resources.h" | 13 #include "components/grit/components_resources.h" |
| 14 #include "components/signin/core/browser/about_signin_internals.h" | 14 #include "components/signin/core/browser/about_signin_internals.h" |
| 15 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 15 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
| 16 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
| 17 #include "content/public/browser/web_ui_data_source.h" | 17 #include "content/public/browser/web_ui_data_source.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 content::WebUIDataSource* CreateSignInInternalsHTMLSource() { | 21 content::WebUIDataSource* CreateSignInInternalsHTMLSource() { |
| 22 content::WebUIDataSource* source = | 22 content::WebUIDataSource* source = |
| 23 content::WebUIDataSource::Create(chrome::kChromeUISignInInternalsHost); | 23 content::WebUIDataSource::Create(chrome::kChromeUISignInInternalsHost); |
| 24 | 24 |
| 25 source->SetJsonPath("strings.js"); | 25 source->SetJsonPath("strings.js"); |
| 26 source->AddResourcePath("signin_internals.js", IDR_SIGNIN_INTERNALS_INDEX_JS); | 26 source->AddResourcePath("signin_internals.js", IDR_SIGNIN_INTERNALS_INDEX_JS); |
| 27 source->SetDefaultResource(IDR_SIGNIN_INTERNALS_INDEX_HTML); | 27 source->SetDefaultResource(IDR_SIGNIN_INTERNALS_INDEX_HTML); |
| 28 source->UseGzipForAllPaths(); |
| 28 return source; | 29 return source; |
| 29 } | 30 } |
| 30 | 31 |
| 31 } // namespace | 32 } // namespace |
| 32 | 33 |
| 33 SignInInternalsUI::SignInInternalsUI(content::WebUI* web_ui) | 34 SignInInternalsUI::SignInInternalsUI(content::WebUI* web_ui) |
| 34 : WebUIController(web_ui) { | 35 : WebUIController(web_ui) { |
| 35 Profile* profile = Profile::FromWebUI(web_ui); | 36 Profile* profile = Profile::FromWebUI(web_ui); |
| 36 content::WebUIDataSource::Add(profile, CreateSignInInternalsHTMLSource()); | 37 content::WebUIDataSource::Add(profile, CreateSignInInternalsHTMLSource()); |
| 37 if (profile) { | 38 if (profile) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 102 |
| 102 web_ui()->CallJavascriptFunctionUnsafe( | 103 web_ui()->CallJavascriptFunctionUnsafe( |
| 103 "chrome.signin.onSigninInfoChanged.fire", *info); | 104 "chrome.signin.onSigninInfoChanged.fire", *info); |
| 104 } | 105 } |
| 105 | 106 |
| 106 void SignInInternalsUI::OnCookieAccountsFetched( | 107 void SignInInternalsUI::OnCookieAccountsFetched( |
| 107 const base::DictionaryValue* info) { | 108 const base::DictionaryValue* info) { |
| 108 web_ui()->CallJavascriptFunctionUnsafe( | 109 web_ui()->CallJavascriptFunctionUnsafe( |
| 109 "chrome.signin.onCookieAccountsFetched.fire", *info); | 110 "chrome.signin.onCookieAccountsFetched.fire", *info); |
| 110 } | 111 } |
| OLD | NEW |