| 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_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
| 8 #include "athena/activity/public/activity_manager.h" | 8 #include "athena/activity/public/activity_manager.h" |
| 9 #include "athena/input/public/accelerator_manager.h" | 9 #include "athena/input/public/accelerator_manager.h" |
| 10 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/public/browser/native_web_keyboard_event.h" | 11 #include "content/public/browser/native_web_keyboard_event.h" |
| 11 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
| 12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 14 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 15 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
| 15 #include "ui/views/controls/webview/webview.h" | 16 #include "ui/views/controls/webview/webview.h" |
| 16 #include "ui/views/focus/focus_manager.h" | 17 #include "ui/views/focus/focus_manager.h" |
| 17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 18 | 19 |
| 19 namespace athena { | 20 namespace athena { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 DCHECK(web_view_); | 351 DCHECK(web_view_); |
| 351 web_view_->InstallAccelerators(); | 352 web_view_->InstallAccelerators(); |
| 352 } | 353 } |
| 353 | 354 |
| 354 SkColor WebActivity::GetRepresentativeColor() const { | 355 SkColor WebActivity::GetRepresentativeColor() const { |
| 355 // TODO(sad): Compute the color from the favicon. | 356 // TODO(sad): Compute the color from the favicon. |
| 356 return web_view_ ? title_color_ : kDefaultUnavailableColor; | 357 return web_view_ ? title_color_ : kDefaultUnavailableColor; |
| 357 } | 358 } |
| 358 | 359 |
| 359 base::string16 WebActivity::GetTitle() const { | 360 base::string16 WebActivity::GetTitle() const { |
| 360 return web_view_ ? web_view_->GetWebContents()->GetTitle() : base::string16(); | 361 return web_view_ ? base::UTF8ToUTF16( |
| 362 web_view_->GetWebContents()->GetVisibleURL().host()) |
| 363 : base::string16(); |
| 361 } | 364 } |
| 362 | 365 |
| 363 bool WebActivity::UsesFrame() const { | 366 bool WebActivity::UsesFrame() const { |
| 364 return true; | 367 return true; |
| 365 } | 368 } |
| 366 | 369 |
| 367 views::View* WebActivity::GetContentsView() { | 370 views::View* WebActivity::GetContentsView() { |
| 368 if (!web_view_) { | 371 if (!web_view_) { |
| 369 web_view_ = new AthenaWebView(browser_context_); | 372 web_view_ = new AthenaWebView(browser_context_); |
| 370 web_view_->LoadInitialURL(url_); | 373 web_view_->LoadInitialURL(url_); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 391 void WebActivity::DidUpdateFaviconURL( | 394 void WebActivity::DidUpdateFaviconURL( |
| 392 const std::vector<content::FaviconURL>& candidates) { | 395 const std::vector<content::FaviconURL>& candidates) { |
| 393 ActivityManager::Get()->UpdateActivity(this); | 396 ActivityManager::Get()->UpdateActivity(this); |
| 394 } | 397 } |
| 395 | 398 |
| 396 void WebActivity::DidChangeThemeColor(SkColor theme_color) { | 399 void WebActivity::DidChangeThemeColor(SkColor theme_color) { |
| 397 title_color_ = theme_color; | 400 title_color_ = theme_color; |
| 398 } | 401 } |
| 399 | 402 |
| 400 } // namespace athena | 403 } // namespace athena |
| OLD | NEW |