OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/content/web_activity.h" | 5 #include "athena/content/web_activity.h" |
6 | 6 |
7 #include "athena/activity/public/activity_manager.h" | 7 #include "athena/activity/public/activity_manager.h" |
8 #include "athena/input/public/accelerator_manager.h" | 8 #include "athena/input/public/accelerator_manager.h" |
9 #include "content/public/browser/native_web_keyboard_event.h" | 9 #include "content/public/browser/native_web_keyboard_event.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 scoped_ptr<WebActivityController> controller_; | 144 scoped_ptr<WebActivityController> controller_; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(AthenaWebView); | 146 DISALLOW_COPY_AND_ASSIGN(AthenaWebView); |
147 }; | 147 }; |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 | 150 |
151 WebActivity::WebActivity(content::BrowserContext* browser_context, | 151 WebActivity::WebActivity(content::BrowserContext* browser_context, |
152 const GURL& url) | 152 const GURL& url) |
153 : browser_context_(browser_context), url_(url), web_view_(NULL) { | 153 : browser_context_(browser_context), |
| 154 url_(url), |
| 155 web_view_(NULL) { |
154 } | 156 } |
155 | 157 |
156 WebActivity::~WebActivity() { | 158 WebActivity::~WebActivity() { |
157 } | 159 } |
158 | 160 |
159 ActivityViewModel* WebActivity::GetActivityViewModel() { | 161 ActivityViewModel* WebActivity::GetActivityViewModel() { |
160 return this; | 162 return this; |
161 } | 163 } |
162 | 164 |
163 void WebActivity::Init() { | 165 void WebActivity::Init() { |
164 DCHECK(web_view_); | 166 DCHECK(web_view_); |
165 static_cast<AthenaWebView*>(web_view_)->InstallAccelerators(); | 167 static_cast<AthenaWebView*>(web_view_)->InstallAccelerators(); |
166 } | 168 } |
167 | 169 |
168 SkColor WebActivity::GetRepresentativeColor() { | 170 SkColor WebActivity::GetRepresentativeColor() const { |
169 // TODO(sad): Compute the color from the favicon. | 171 // TODO(sad): Compute the color from the favicon. |
170 return SK_ColorGRAY; | 172 return SK_ColorGRAY; |
171 } | 173 } |
172 | 174 |
173 base::string16 WebActivity::GetTitle() { | 175 base::string16 WebActivity::GetTitle() const { |
174 return web_view_->GetWebContents()->GetTitle(); | 176 return web_view_->GetWebContents()->GetTitle(); |
175 } | 177 } |
176 | 178 |
| 179 bool WebActivity::UsesFrame() const { |
| 180 return true; |
| 181 } |
| 182 |
177 views::View* WebActivity::GetContentsView() { | 183 views::View* WebActivity::GetContentsView() { |
178 if (!web_view_) { | 184 if (!web_view_) { |
179 web_view_ = new AthenaWebView(browser_context_); | 185 web_view_ = new AthenaWebView(browser_context_); |
180 web_view_->LoadInitialURL(url_); | 186 web_view_->LoadInitialURL(url_); |
181 Observe(web_view_->GetWebContents()); | 187 Observe(web_view_->GetWebContents()); |
182 } | 188 } |
183 return web_view_; | 189 return web_view_; |
184 } | 190 } |
185 | 191 |
186 void WebActivity::TitleWasSet(content::NavigationEntry* entry, | 192 void WebActivity::TitleWasSet(content::NavigationEntry* entry, |
187 bool explicit_set) { | 193 bool explicit_set) { |
188 ActivityManager::Get()->UpdateActivity(this); | 194 ActivityManager::Get()->UpdateActivity(this); |
189 } | 195 } |
190 | 196 |
191 void WebActivity::DidUpdateFaviconURL( | 197 void WebActivity::DidUpdateFaviconURL( |
192 const std::vector<content::FaviconURL>& candidates) { | 198 const std::vector<content::FaviconURL>& candidates) { |
193 ActivityManager::Get()->UpdateActivity(this); | 199 ActivityManager::Get()->UpdateActivity(this); |
194 } | 200 } |
195 | 201 |
196 } // namespace athena | 202 } // namespace athena |
OLD | NEW |