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/chromeos/login/registration_screen.h" | 5 #include "chrome/browser/chromeos/login/registration_screen.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // RegistrationView, protected: | 49 // RegistrationView, protected: |
50 | 50 |
51 WebPageDomView* RegistrationView::dom_view() { | 51 WebPageDomView* RegistrationView::dom_view() { |
52 return dom_view_; | 52 return dom_view_; |
53 } | 53 } |
54 | 54 |
55 /////////////////////////////////////////////////////////////////////////////// | 55 /////////////////////////////////////////////////////////////////////////////// |
56 // RegistrationScreen, public: | 56 // RegistrationScreen, public: |
57 RegistrationScreen::RegistrationScreen(ViewScreenDelegate* delegate) | 57 RegistrationScreen::RegistrationScreen(ViewScreenDelegate* delegate) |
58 : ViewScreen<RegistrationView>(delegate) { | 58 : ViewScreen<RegistrationView>(delegate) { |
59 if (!host_page_url_.get()) | |
60 set_registration_host_page_url(GURL(kRegistrationHostPageUrl)); | |
61 | |
62 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | 59 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
63 chrome::kCrosScheme); | 60 chrome::kCrosScheme); |
64 net::URLRequestFilter::GetInstance()->AddHostnameHandler( | 61 net::URLRequestFilter::GetInstance()->AddHostnameHandler( |
65 chrome::kCrosScheme, | 62 chrome::kCrosScheme, |
66 kRegistrationHostnameUrl, | 63 kRegistrationHostnameUrl, |
67 &RegistrationScreen::Factory); | 64 &RegistrationScreen::Factory); |
68 } | 65 } |
69 | 66 |
70 // static | |
71 void RegistrationScreen::set_registration_host_page_url(const GURL& url) { | |
72 host_page_url_.reset(new GURL(url)); | |
73 } | |
74 | |
75 // static | |
76 scoped_ptr<GURL> RegistrationScreen::host_page_url_; | |
77 | |
78 /////////////////////////////////////////////////////////////////////////////// | 67 /////////////////////////////////////////////////////////////////////////////// |
79 // RegistrationScreen, ViewScreen implementation: | 68 // RegistrationScreen, ViewScreen implementation: |
80 void RegistrationScreen::CreateView() { | 69 void RegistrationScreen::CreateView() { |
81 ViewScreen<RegistrationView>::CreateView(); | 70 ViewScreen<RegistrationView>::CreateView(); |
82 view()->SetWebPageDelegate(this); | 71 view()->SetWebPageDelegate(this); |
83 } | 72 } |
84 | 73 |
85 void RegistrationScreen::Refresh() { | 74 void RegistrationScreen::Refresh() { |
86 StartTimeoutTimer(); | 75 StartTimeoutTimer(); |
87 GURL url(*host_page_url_); | 76 GURL url(kRegistrationHostPageUrl); |
88 Profile* profile = ProfileManager::GetDefaultProfile(); | 77 Profile* profile = ProfileManager::GetDefaultProfile(); |
89 view()->InitDOM(profile, | 78 view()->InitDOM(profile, |
90 SiteInstance::CreateSiteInstanceForURL(profile, url)); | 79 SiteInstance::CreateSiteInstanceForURL(profile, url)); |
91 view()->SetTabContentsDelegate(this); | 80 view()->SetTabContentsDelegate(this); |
92 view()->LoadURL(url); | 81 view()->LoadURL(url); |
93 } | 82 } |
94 | 83 |
95 RegistrationView* RegistrationScreen::AllocateView() { | 84 RegistrationView* RegistrationScreen::AllocateView() { |
96 return new RegistrationView(); | 85 return new RegistrationView(); |
97 } | 86 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 160 } |
172 | 161 |
173 // static | 162 // static |
174 net::URLRequestJob* RegistrationScreen::Factory(net::URLRequest* request, | 163 net::URLRequestJob* RegistrationScreen::Factory(net::URLRequest* request, |
175 const std::string& scheme) { | 164 const std::string& scheme) { |
176 VLOG(1) << "Handling url: " << request->url().spec().c_str(); | 165 VLOG(1) << "Handling url: " << request->url().spec().c_str(); |
177 return new net::URLRequestAboutJob(request); | 166 return new net::URLRequestAboutJob(request); |
178 } | 167 } |
179 | 168 |
180 } // namespace chromeos | 169 } // namespace chromeos |
OLD | NEW |