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 |
54 void WebPageDomView::SetWebContentsDelegate( | 58 void WebPageDomView::SetWebContentsDelegate( |
55 content::WebContentsDelegate* delegate) { | 59 content::WebContentsDelegate* delegate) { |
56 dom_contents_->web_contents()->SetDelegate(delegate); | 60 web_contents()->SetDelegate(delegate); |
57 } | 61 } |
58 | 62 |
59 /////////////////////////////////////////////////////////////////////////////// | 63 /////////////////////////////////////////////////////////////////////////////// |
60 // WebPageView, public: | 64 // WebPageView, public: |
61 | 65 |
62 WebPageView::WebPageView() : throbber_(NULL), connecting_label_(NULL) {} | 66 WebPageView::WebPageView() : throbber_(NULL), connecting_label_(NULL) {} |
63 | 67 |
64 WebPageView::~WebPageView() {} | 68 WebPageView::~WebPageView() {} |
65 | 69 |
66 void WebPageView::Init() { | 70 void WebPageView::Init() { |
(...skipping 15 matching lines...) Expand all Loading... |
82 connecting_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); | 86 connecting_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); |
83 connecting_label_->SetVisible(false); | 87 connecting_label_->SetVisible(false); |
84 AddChildView(connecting_label_); | 88 AddChildView(connecting_label_); |
85 | 89 |
86 start_timer_.Start(FROM_HERE, | 90 start_timer_.Start(FROM_HERE, |
87 TimeDelta::FromMilliseconds(kStartDelayMs), | 91 TimeDelta::FromMilliseconds(kStartDelayMs), |
88 this, | 92 this, |
89 &WebPageView::ShowWaitingControls); | 93 &WebPageView::ShowWaitingControls); |
90 } | 94 } |
91 | 95 |
92 void WebPageView::InitDOM(Profile* profile, | 96 void WebPageView::InitWebView(SiteInstance* site_instance) { |
93 SiteInstance* site_instance) { | 97 dom_view()->CreateWebContentsWithSiteInstance(site_instance); |
94 dom_view()->Init(profile, site_instance); | |
95 } | 98 } |
96 | 99 |
97 void WebPageView::LoadURL(const GURL& url) { | 100 void WebPageView::LoadURL(const GURL& url) { |
98 dom_view()->LoadURL(url); | 101 dom_view()->LoadInitialURL(url); |
99 } | 102 } |
100 | 103 |
101 void WebPageView::SetWebContentsDelegate( | 104 void WebPageView::SetWebContentsDelegate( |
102 content::WebContentsDelegate* delegate) { | 105 content::WebContentsDelegate* delegate) { |
103 dom_view()->SetWebContentsDelegate(delegate); | 106 dom_view()->SetWebContentsDelegate(delegate); |
104 } | 107 } |
105 | 108 |
106 void WebPageView::ShowPageContent() { | 109 void WebPageView::ShowPageContent() { |
107 // TODO(nkostylev): Show throbber as an overlay until page has been rendered. | 110 // TODO(nkostylev): Show throbber as an overlay until page has been rendered. |
108 start_timer_.Stop(); | 111 start_timer_.Stop(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 throbber_->GetPreferredSize().width(), | 143 throbber_->GetPreferredSize().width(), |
141 throbber_->GetPreferredSize().height()); | 144 throbber_->GetPreferredSize().height()); |
142 connecting_label_->SetBounds( | 145 connecting_label_->SetBounds( |
143 width() / 2 - connecting_label_->GetPreferredSize().width() / 2, | 146 width() / 2 - connecting_label_->GetPreferredSize().width() / 2, |
144 y + throbber_->GetPreferredSize().height() + kSpacing, | 147 y + throbber_->GetPreferredSize().height() + kSpacing, |
145 connecting_label_->GetPreferredSize().width(), | 148 connecting_label_->GetPreferredSize().width(), |
146 connecting_label_->GetPreferredSize().height()); | 149 connecting_label_->GetPreferredSize().height()); |
147 } | 150 } |
148 | 151 |
149 } // namespace chromeos | 152 } // namespace chromeos |
OLD | NEW |