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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // reside here. | 331 // reside here. |
331 if (IsVisible() && current_state_ != ACTIVITY_VISIBLE) | 332 if (IsVisible() && current_state_ != ACTIVITY_VISIBLE) |
332 SetCurrentState(ACTIVITY_VISIBLE); | 333 SetCurrentState(ACTIVITY_VISIBLE); |
333 // Note: If the activity is not visible it does not necessarily mean that it | 334 // Note: If the activity is not visible it does not necessarily mean that it |
334 // does not have GPU compositor resources (yet). | 335 // does not have GPU compositor resources (yet). |
335 | 336 |
336 return current_state_; | 337 return current_state_; |
337 } | 338 } |
338 | 339 |
339 bool WebActivity::IsVisible() { | 340 bool WebActivity::IsVisible() { |
340 return web_view_ && web_view_->IsDrawn(); | 341 return web_view_ && |
| 342 web_view_->IsDrawn() && |
| 343 current_state_ != ACTIVITY_UNLOADED && |
| 344 GetWindow() && |
| 345 GetWindow()->IsVisible(); |
341 } | 346 } |
342 | 347 |
343 Activity::ActivityMediaState WebActivity::GetMediaState() { | 348 Activity::ActivityMediaState WebActivity::GetMediaState() { |
344 // TODO(skuhne): The function GetTabMediaStateForContents(WebContents), | 349 // TODO(skuhne): The function GetTabMediaStateForContents(WebContents), |
345 // and the AudioStreamMonitor needs to be moved from Chrome into contents to | 350 // and the AudioStreamMonitor needs to be moved from Chrome into contents to |
346 // make it more modular and so that we can use it from here. | 351 // make it more modular and so that we can use it from here. |
347 return Activity::ACTIVITY_MEDIA_STATE_NONE; | 352 return Activity::ACTIVITY_MEDIA_STATE_NONE; |
348 } | 353 } |
349 | 354 |
350 aura::Window* WebActivity::GetWindow() { | 355 aura::Window* WebActivity::GetWindow() { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 void WebActivity::DidUpdateFaviconURL( | 403 void WebActivity::DidUpdateFaviconURL( |
399 const std::vector<content::FaviconURL>& candidates) { | 404 const std::vector<content::FaviconURL>& candidates) { |
400 ActivityManager::Get()->UpdateActivity(this); | 405 ActivityManager::Get()->UpdateActivity(this); |
401 } | 406 } |
402 | 407 |
403 void WebActivity::DidChangeThemeColor(SkColor theme_color) { | 408 void WebActivity::DidChangeThemeColor(SkColor theme_color) { |
404 title_color_ = theme_color; | 409 title_color_ = theme_color; |
405 } | 410 } |
406 | 411 |
407 } // namespace athena | 412 } // namespace athena |
OLD | NEW |