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/web_page_view.h" | 5 #include "chrome/browser/chromeos/login/web_page_view.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const int kStartDelayMs = 500; | 44 const int kStartDelayMs = 500; |
45 | 45 |
46 // Time in ms after that waiting controls are hidden on Stop. | 46 // Time in ms after that waiting controls are hidden on Stop. |
47 const int kStopDelayMs = 500; | 47 const int kStopDelayMs = 500; |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 /////////////////////////////////////////////////////////////////////////////// | 51 /////////////////////////////////////////////////////////////////////////////// |
52 // WebPageDomView, public: | 52 // WebPageDomView, public: |
53 | 53 |
54 WebPageDomView::WebPageDomView(content::BrowserContext* browser_context) | |
55 : views::WebView(browser_context) { | |
56 } | |
57 | |
58 void WebPageDomView::SetWebContentsDelegate( | 54 void WebPageDomView::SetWebContentsDelegate( |
59 content::WebContentsDelegate* delegate) { | 55 content::WebContentsDelegate* delegate) { |
60 web_contents()->SetDelegate(delegate); | 56 dom_contents_->web_contents()->SetDelegate(delegate); |
61 } | 57 } |
62 | 58 |
63 /////////////////////////////////////////////////////////////////////////////// | 59 /////////////////////////////////////////////////////////////////////////////// |
64 // WebPageView, public: | 60 // WebPageView, public: |
65 | 61 |
66 WebPageView::WebPageView() : throbber_(NULL), connecting_label_(NULL) {} | 62 WebPageView::WebPageView() : throbber_(NULL), connecting_label_(NULL) {} |
67 | 63 |
68 WebPageView::~WebPageView() {} | 64 WebPageView::~WebPageView() {} |
69 | 65 |
70 void WebPageView::Init() { | 66 void WebPageView::Init() { |
(...skipping 15 matching lines...) Expand all Loading... |
86 connecting_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); | 82 connecting_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); |
87 connecting_label_->SetVisible(false); | 83 connecting_label_->SetVisible(false); |
88 AddChildView(connecting_label_); | 84 AddChildView(connecting_label_); |
89 | 85 |
90 start_timer_.Start(FROM_HERE, | 86 start_timer_.Start(FROM_HERE, |
91 TimeDelta::FromMilliseconds(kStartDelayMs), | 87 TimeDelta::FromMilliseconds(kStartDelayMs), |
92 this, | 88 this, |
93 &WebPageView::ShowWaitingControls); | 89 &WebPageView::ShowWaitingControls); |
94 } | 90 } |
95 | 91 |
96 void WebPageView::InitWebView(SiteInstance* site_instance) { | 92 void WebPageView::InitDOM(Profile* profile, |
97 dom_view()->CreateWebContentsWithSiteInstance(site_instance); | 93 SiteInstance* site_instance) { |
| 94 dom_view()->Init(profile, site_instance); |
98 } | 95 } |
99 | 96 |
100 void WebPageView::LoadURL(const GURL& url) { | 97 void WebPageView::LoadURL(const GURL& url) { |
101 dom_view()->LoadInitialURL(url); | 98 dom_view()->LoadURL(url); |
102 } | 99 } |
103 | 100 |
104 void WebPageView::SetWebContentsDelegate( | 101 void WebPageView::SetWebContentsDelegate( |
105 content::WebContentsDelegate* delegate) { | 102 content::WebContentsDelegate* delegate) { |
106 dom_view()->SetWebContentsDelegate(delegate); | 103 dom_view()->SetWebContentsDelegate(delegate); |
107 } | 104 } |
108 | 105 |
109 void WebPageView::ShowPageContent() { | 106 void WebPageView::ShowPageContent() { |
110 // TODO(nkostylev): Show throbber as an overlay until page has been rendered. | 107 // TODO(nkostylev): Show throbber as an overlay until page has been rendered. |
111 start_timer_.Stop(); | 108 start_timer_.Stop(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 throbber_->GetPreferredSize().width(), | 140 throbber_->GetPreferredSize().width(), |
144 throbber_->GetPreferredSize().height()); | 141 throbber_->GetPreferredSize().height()); |
145 connecting_label_->SetBounds( | 142 connecting_label_->SetBounds( |
146 width() / 2 - connecting_label_->GetPreferredSize().width() / 2, | 143 width() / 2 - connecting_label_->GetPreferredSize().width() / 2, |
147 y + throbber_->GetPreferredSize().height() + kSpacing, | 144 y + throbber_->GetPreferredSize().height() + kSpacing, |
148 connecting_label_->GetPreferredSize().width(), | 145 connecting_label_->GetPreferredSize().width(), |
149 connecting_label_->GetPreferredSize().height()); | 146 connecting_label_->GetPreferredSize().height()); |
150 } | 147 } |
151 | 148 |
152 } // namespace chromeos | 149 } // namespace chromeos |
OLD | NEW |