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