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/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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 AddChildView(throbber_); | 116 AddChildView(throbber_); |
117 | 117 |
118 connecting_label_ = new views::Label(); | 118 connecting_label_ = new views::Label(); |
119 connecting_label_->SetText( | 119 connecting_label_->SetText( |
120 UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOAD_STATE_CONNECTING))); | 120 UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOAD_STATE_CONNECTING))); |
121 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 121 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
122 connecting_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); | 122 connecting_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); |
123 connecting_label_->SetVisible(false); | 123 connecting_label_->SetVisible(false); |
124 AddChildView(connecting_label_ ); | 124 AddChildView(connecting_label_ ); |
125 | 125 |
126 start_timer_.Start(FROM_HERE, | 126 start_timer_.Start(TimeDelta::FromMilliseconds(kStartDelayMs), |
127 TimeDelta::FromMilliseconds(kStartDelayMs), | |
128 this, | 127 this, |
129 &WebPageView::ShowWaitingControls); | 128 &WebPageView::ShowWaitingControls); |
130 } | 129 } |
131 | 130 |
132 void WebPageView::InitDOM(Profile* profile, | 131 void WebPageView::InitDOM(Profile* profile, |
133 SiteInstance* site_instance) { | 132 SiteInstance* site_instance) { |
134 dom_view()->Init(profile, site_instance); | 133 dom_view()->Init(profile, site_instance); |
135 } | 134 } |
136 | 135 |
137 void WebPageView::LoadURL(const GURL& url) { | 136 void WebPageView::LoadURL(const GURL& url) { |
138 dom_view()->LoadURL(url); | 137 dom_view()->LoadURL(url); |
139 } | 138 } |
140 | 139 |
141 void WebPageView::SetTabContentsDelegate( | 140 void WebPageView::SetTabContentsDelegate( |
142 TabContentsDelegate* delegate) { | 141 TabContentsDelegate* delegate) { |
143 dom_view()->SetTabContentsDelegate(delegate); | 142 dom_view()->SetTabContentsDelegate(delegate); |
144 } | 143 } |
145 | 144 |
146 void WebPageView::SetWebPageDelegate(WebPageDelegate* delegate) { | 145 void WebPageView::SetWebPageDelegate(WebPageDelegate* delegate) { |
147 dom_view()->set_web_page_delegate(delegate); | 146 dom_view()->set_web_page_delegate(delegate); |
148 } | 147 } |
149 | 148 |
150 void WebPageView::ShowPageContent() { | 149 void WebPageView::ShowPageContent() { |
151 // TODO(nkostylev): Show throbber as an overlay until page has been rendered. | 150 // TODO(nkostylev): Show throbber as an overlay until page has been rendered. |
152 start_timer_.Stop(); | 151 start_timer_.Stop(); |
153 if (!stop_timer_.IsRunning()) { | 152 if (!stop_timer_.IsRunning()) { |
154 stop_timer_.Start(FROM_HERE, | 153 stop_timer_.Start(TimeDelta::FromMilliseconds(kStopDelayMs), |
155 TimeDelta::FromMilliseconds(kStopDelayMs), | |
156 this, | 154 this, |
157 &WebPageView::ShowRenderedPage); | 155 &WebPageView::ShowRenderedPage); |
158 } | 156 } |
159 } | 157 } |
160 | 158 |
161 /////////////////////////////////////////////////////////////////////////////// | 159 /////////////////////////////////////////////////////////////////////////////// |
162 // WebPageView, private: | 160 // WebPageView, private: |
163 | 161 |
164 void WebPageView::ShowRenderedPage() { | 162 void WebPageView::ShowRenderedPage() { |
165 throbber_->Stop(); | 163 throbber_->Stop(); |
(...skipping 18 matching lines...) Expand all Loading... |
184 throbber_->GetPreferredSize().width(), | 182 throbber_->GetPreferredSize().width(), |
185 throbber_->GetPreferredSize().height()); | 183 throbber_->GetPreferredSize().height()); |
186 connecting_label_->SetBounds( | 184 connecting_label_->SetBounds( |
187 width() / 2 - connecting_label_->GetPreferredSize().width() / 2, | 185 width() / 2 - connecting_label_->GetPreferredSize().width() / 2, |
188 y + throbber_->GetPreferredSize().height() + kSpacing, | 186 y + throbber_->GetPreferredSize().height() + kSpacing, |
189 connecting_label_->GetPreferredSize().width(), | 187 connecting_label_->GetPreferredSize().width(), |
190 connecting_label_->GetPreferredSize().height()); | 188 connecting_label_->GetPreferredSize().height()); |
191 } | 189 } |
192 | 190 |
193 } // namespace chromeos | 191 } // namespace chromeos |
OLD | NEW |