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 "base/strings/utf_string_conversions.h" |
11 #include "content/public/browser/native_web_keyboard_event.h" | 11 #include "content/public/browser/native_web_keyboard_event.h" |
12 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
| 15 #include "ui/aura/window.h" |
15 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 16 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
16 #include "ui/views/controls/webview/webview.h" | 17 #include "ui/views/controls/webview/webview.h" |
17 #include "ui/views/focus/focus_manager.h" | 18 #include "ui/views/focus/focus_manager.h" |
18 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
19 | 20 |
20 namespace athena { | 21 namespace athena { |
21 namespace { | 22 namespace { |
22 | 23 |
23 class WebActivityController : public AcceleratorHandler { | 24 class WebActivityController : public AcceleratorHandler { |
24 public: | 25 public: |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // reside here. | 340 // reside here. |
340 if (IsVisible() && current_state_ != ACTIVITY_VISIBLE) | 341 if (IsVisible() && current_state_ != ACTIVITY_VISIBLE) |
341 SetCurrentState(ACTIVITY_VISIBLE); | 342 SetCurrentState(ACTIVITY_VISIBLE); |
342 // Note: If the activity is not visible it does not necessarily mean that it | 343 // Note: If the activity is not visible it does not necessarily mean that it |
343 // does not have GPU compositor resources (yet). | 344 // does not have GPU compositor resources (yet). |
344 | 345 |
345 return current_state_; | 346 return current_state_; |
346 } | 347 } |
347 | 348 |
348 bool WebActivity::IsVisible() { | 349 bool WebActivity::IsVisible() { |
349 return web_view_ && web_view_->IsDrawn(); | 350 return web_view_ && |
| 351 web_view_->IsDrawn() && |
| 352 current_state_ != ACTIVITY_UNLOADED && |
| 353 GetWindow() && |
| 354 GetWindow()->IsVisible(); |
350 } | 355 } |
351 | 356 |
352 Activity::ActivityMediaState WebActivity::GetMediaState() { | 357 Activity::ActivityMediaState WebActivity::GetMediaState() { |
353 // TODO(skuhne): The function GetTabMediaStateForContents(WebContents), | 358 // TODO(skuhne): The function GetTabMediaStateForContents(WebContents), |
354 // and the AudioStreamMonitor needs to be moved from Chrome into contents to | 359 // and the AudioStreamMonitor needs to be moved from Chrome into contents to |
355 // make it more modular and so that we can use it from here. | 360 // make it more modular and so that we can use it from here. |
356 return Activity::ACTIVITY_MEDIA_STATE_NONE; | 361 return Activity::ACTIVITY_MEDIA_STATE_NONE; |
357 } | 362 } |
358 | 363 |
359 aura::Window* WebActivity::GetWindow() { | 364 aura::Window* WebActivity::GetWindow() { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 void WebActivity::DidUpdateFaviconURL( | 412 void WebActivity::DidUpdateFaviconURL( |
408 const std::vector<content::FaviconURL>& candidates) { | 413 const std::vector<content::FaviconURL>& candidates) { |
409 ActivityManager::Get()->UpdateActivity(this); | 414 ActivityManager::Get()->UpdateActivity(this); |
410 } | 415 } |
411 | 416 |
412 void WebActivity::DidChangeThemeColor(SkColor theme_color) { | 417 void WebActivity::DidChangeThemeColor(SkColor theme_color) { |
413 title_color_ = theme_color; | 418 title_color_ = theme_color; |
414 } | 419 } |
415 | 420 |
416 } // namespace athena | 421 } // namespace athena |
OLD | NEW |