Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: chrome/browser/chromeos/login/enrollment/enterprise_enrollment_view.cc

Issue 8436002: [cros] Remove Views implementation for login/OOBE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_view.h"
6
7 #include "base/json/json_writer.h"
8 #include "base/values.h"
9 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen. h"
10 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen_ actor.h"
11 #include "chrome/browser/chromeos/login/helper.h"
12 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h"
15 #include "chrome/common/url_constants.h"
16 #include "content/browser/renderer_host/render_view_host.h"
17 #include "content/browser/site_instance.h"
18 #include "content/browser/tab_contents/tab_contents_delegate.h"
19 #include "ui/base/l10n/l10n_util.h"
20 #include "views/border.h"
21 #include "views/layout/layout_constants.h"
22
23 namespace chromeos {
24
25 namespace {
26
27 // Layout constants.
28 const int kBorderSize = 30;
29
30 // Renders the registration page.
31 class EnrollmentDomView : public WebPageDomView,
32 public TabContentsDelegate {
33 public:
34 EnrollmentDomView() {}
35 virtual ~EnrollmentDomView() {
36 }
37
38 protected:
39 // DomView implementation:
40 virtual TabContents* CreateTabContents(Profile* profile,
41 SiteInstance* instance) {
42 TabContents* contents = new WizardWebPageViewTabContents(profile,
43 instance,
44 page_delegate_);
45 contents->set_delegate(this);
46 return contents;
47 }
48
49 // TabContentsDelegate implementation:
50 virtual bool IsPopup(TabContents* source) { return false; }
51 virtual bool ShouldAddNavigationToHistory(
52 const history::HistoryAddPageArgs& add_page_args,
53 content::NavigationType navigation_type) {
54 return false;
55 }
56 virtual bool HandleContextMenu(const ContextMenuParams& params) {
57 return true;
58 }
59
60 private:
61 DISALLOW_COPY_AND_ASSIGN(EnrollmentDomView);
62 };
63
64 } // namespace
65
66 EnterpriseEnrollmentView::EnterpriseEnrollmentView(
67 EnterpriseEnrollmentScreenActor::Controller* controller)
68 : controller_(controller), actor_(NULL) {}
69
70 EnterpriseEnrollmentView::~EnterpriseEnrollmentView() {}
71
72 void EnterpriseEnrollmentView::Init() {
73 // Use rounded rect background.
74 views::Painter* painter =
75 CreateWizardPainter(&BorderDefinition::kScreenBorder);
76 set_background(views::Background::CreateBackgroundPainter(true, painter));
77
78 // Create the view that hosts the enrollment page.
79 enrollment_page_view_ = new EnrollmentDomView();
80 enrollment_page_view_->set_border(
81 views::Border::CreateEmptyBorder(kBorderSize, kBorderSize,
82 kBorderSize, kBorderSize));
83
84 AddChildView(enrollment_page_view_);
85
86 // Load the enrollment page.
87 Profile* profile = ProfileManager::GetDefaultProfile();
88 GURL url(chrome::kChromeUIEnterpriseEnrollmentURL);
89 enrollment_page_view_->Init(
90 profile, SiteInstance::CreateSiteInstanceForURL(profile, url));
91
92 enrollment_page_view_->LoadURL(url);
93 actor_ = static_cast<EnterpriseEnrollmentUI*>(enrollment_page_view_->
94 dom_contents()->tab_contents()->web_ui())->GetActor();
95 actor_->SetController(controller_);
96 }
97
98 EnterpriseEnrollmentScreenActor* EnterpriseEnrollmentView::GetActor() {
99 return actor_;
100 }
101
102 void EnterpriseEnrollmentView::Layout() {
103 enrollment_page_view_->SetBoundsRect(GetContentsBounds());
104 }
105
106 void EnterpriseEnrollmentView::RequestFocus() {
107 enrollment_page_view_->RequestFocus();
108 }
109
110 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698