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/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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // Host page navigates to these URLs in case of success/skipped registration. | 36 // Host page navigates to these URLs in case of success/skipped registration. |
37 const char kRegistrationSuccessUrl[] = "cros://register/success"; | 37 const char kRegistrationSuccessUrl[] = "cros://register/success"; |
38 const char kRegistrationSkippedUrl[] = "cros://register/skipped"; | 38 const char kRegistrationSkippedUrl[] = "cros://register/skipped"; |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 /////////////////////////////////////////////////////////////////////////////// | 42 /////////////////////////////////////////////////////////////////////////////// |
43 // RegistrationView, protected: | 43 // RegistrationView, protected: |
44 | 44 |
45 RegistrationView::RegistrationView(content::BrowserContext* browser_context) | |
46 : dom_view_(new WebPageDomView(browser_context)) { | |
47 } | |
48 | |
49 | |
50 WebPageDomView* RegistrationView::dom_view() { | 45 WebPageDomView* RegistrationView::dom_view() { |
51 return dom_view_; | 46 return dom_view_; |
52 } | 47 } |
53 | 48 |
54 /////////////////////////////////////////////////////////////////////////////// | 49 /////////////////////////////////////////////////////////////////////////////// |
55 // RegistrationScreen, public: | 50 // RegistrationScreen, public: |
56 RegistrationScreen::RegistrationScreen(ViewScreenDelegate* delegate) | 51 RegistrationScreen::RegistrationScreen(ViewScreenDelegate* delegate) |
57 : ViewScreen<RegistrationView>(delegate) { | 52 : ViewScreen<RegistrationView>(delegate) { |
58 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | 53 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
59 chrome::kCrosScheme); | 54 chrome::kCrosScheme); |
60 net::URLRequestFilter::GetInstance()->AddHostnameHandler( | 55 net::URLRequestFilter::GetInstance()->AddHostnameHandler( |
61 chrome::kCrosScheme, | 56 chrome::kCrosScheme, |
62 kRegistrationHostnameUrl, | 57 kRegistrationHostnameUrl, |
63 &RegistrationScreen::Factory); | 58 &RegistrationScreen::Factory); |
64 } | 59 } |
65 | 60 |
66 RegistrationScreen::~RegistrationScreen() { | 61 RegistrationScreen::~RegistrationScreen() { |
67 } | 62 } |
68 | 63 |
69 /////////////////////////////////////////////////////////////////////////////// | 64 /////////////////////////////////////////////////////////////////////////////// |
70 // RegistrationScreen, ViewScreen implementation: | 65 // RegistrationScreen, ViewScreen implementation: |
71 void RegistrationScreen::CreateView() { | 66 void RegistrationScreen::CreateView() { |
72 ViewScreen<RegistrationView>::CreateView(); | 67 ViewScreen<RegistrationView>::CreateView(); |
73 } | 68 } |
74 | 69 |
75 void RegistrationScreen::Refresh() { | 70 void RegistrationScreen::Refresh() { |
76 StartTimeoutTimer(); | 71 StartTimeoutTimer(); |
77 GURL url(kRegistrationHostPageUrl); | 72 GURL url(kRegistrationHostPageUrl); |
78 Profile* profile = ProfileManager::GetDefaultProfile(); | 73 Profile* profile = ProfileManager::GetDefaultProfile(); |
79 view()->InitWebView(SiteInstance::CreateForURL(profile, url)); | 74 view()->InitDOM(profile, SiteInstance::CreateForURL(profile, url)); |
80 view()->SetWebContentsDelegate(this); | 75 view()->SetWebContentsDelegate(this); |
81 view()->LoadURL(url); | 76 view()->LoadURL(url); |
82 } | 77 } |
83 | 78 |
84 RegistrationView* RegistrationScreen::AllocateView() { | 79 RegistrationView* RegistrationScreen::AllocateView() { |
85 return new RegistrationView(ProfileManager::GetDefaultProfile()); | 80 return new RegistrationView(); |
86 } | 81 } |
87 | 82 |
88 /////////////////////////////////////////////////////////////////////////////// | 83 /////////////////////////////////////////////////////////////////////////////// |
89 // RegistrationScreen, content::WebContentsDelegate implementation: | 84 // RegistrationScreen, content::WebContentsDelegate implementation: |
90 | 85 |
91 WebContents* RegistrationScreen::OpenURLFromTab(WebContents* source, | 86 WebContents* RegistrationScreen::OpenURLFromTab(WebContents* source, |
92 const OpenURLParams& params) { | 87 const OpenURLParams& params) { |
93 if (params.url.spec() == kRegistrationSuccessUrl) { | 88 if (params.url.spec() == kRegistrationSuccessUrl) { |
94 source->Stop(); | 89 source->Stop(); |
95 VLOG(1) << "Registration form completed."; | 90 VLOG(1) << "Registration form completed."; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 124 } |
130 | 125 |
131 // static | 126 // static |
132 net::URLRequestJob* RegistrationScreen::Factory(net::URLRequest* request, | 127 net::URLRequestJob* RegistrationScreen::Factory(net::URLRequest* request, |
133 const std::string& scheme) { | 128 const std::string& scheme) { |
134 VLOG(1) << "Handling url: " << request->url().spec().c_str(); | 129 VLOG(1) << "Handling url: " << request->url().spec().c_str(); |
135 return new net::URLRequestAboutJob(request); | 130 return new net::URLRequestAboutJob(request); |
136 } | 131 } |
137 | 132 |
138 } // namespace chromeos | 133 } // namespace chromeos |
OLD | NEW |