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/content/content_proxy.h" | 9 #include "athena/content/content_proxy.h" |
10 #include "athena/content/media_utils.h" | 10 #include "athena/content/media_utils.h" |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 return web_view_->visible() && current_state_ != ACTIVITY_UNLOADED; | 521 return web_view_->visible() && current_state_ != ACTIVITY_UNLOADED; |
522 } | 522 } |
523 | 523 |
524 Activity::ActivityMediaState WebActivity::GetMediaState() { | 524 Activity::ActivityMediaState WebActivity::GetMediaState() { |
525 return current_state_ == ACTIVITY_UNLOADED ? | 525 return current_state_ == ACTIVITY_UNLOADED ? |
526 Activity::ACTIVITY_MEDIA_STATE_NONE : | 526 Activity::ACTIVITY_MEDIA_STATE_NONE : |
527 GetActivityMediaState(GetWebContents()); | 527 GetActivityMediaState(GetWebContents()); |
528 } | 528 } |
529 | 529 |
530 aura::Window* WebActivity::GetWindow() { | 530 aura::Window* WebActivity::GetWindow() { |
531 return web_view_->GetWidget()->GetNativeWindow(); | 531 return web_view_->GetWidget() ? web_view_->GetWidget()->GetNativeWindow() |
| 532 : nullptr; |
532 } | 533 } |
533 | 534 |
534 content::WebContents* WebActivity::GetWebContents() { | 535 content::WebContents* WebActivity::GetWebContents() { |
535 return web_view_->GetWebContents(); | 536 return web_view_->GetWebContents(); |
536 } | 537 } |
537 | 538 |
538 void WebActivity::Init() { | 539 void WebActivity::Init() { |
539 web_view_->InstallAccelerators(); | 540 web_view_->InstallAccelerators(); |
540 } | 541 } |
541 | 542 |
(...skipping 15 matching lines...) Expand all Loading... |
557 } | 558 } |
558 | 559 |
559 bool WebActivity::UsesFrame() const { | 560 bool WebActivity::UsesFrame() const { |
560 return true; | 561 return true; |
561 } | 562 } |
562 | 563 |
563 views::View* WebActivity::GetContentsView() { | 564 views::View* WebActivity::GetContentsView() { |
564 return web_view_; | 565 return web_view_; |
565 } | 566 } |
566 | 567 |
567 views::Widget* WebActivity::CreateWidget() { | |
568 return nullptr; // Use default widget. | |
569 } | |
570 | |
571 gfx::ImageSkia WebActivity::GetOverviewModeImage() { | 568 gfx::ImageSkia WebActivity::GetOverviewModeImage() { |
572 if (content_proxy_.get()) | 569 if (content_proxy_.get()) |
573 return content_proxy_->GetContentImage(); | 570 return content_proxy_->GetContentImage(); |
574 return gfx::ImageSkia(); | 571 return gfx::ImageSkia(); |
575 } | 572 } |
576 | 573 |
577 void WebActivity::PrepareContentsForOverview() { | 574 void WebActivity::PrepareContentsForOverview() { |
578 // Turn on fast resizing to avoid re-laying out the web contents when | 575 // Turn on fast resizing to avoid re-laying out the web contents when |
579 // entering / exiting overview mode and the content is visible. | 576 // entering / exiting overview mode and the content is visible. |
580 if (!content_proxy_.get()) | 577 if (!content_proxy_.get()) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 if (content_proxy_.get()) | 641 if (content_proxy_.get()) |
645 content_proxy_.reset(nullptr); | 642 content_proxy_.reset(nullptr); |
646 } | 643 } |
647 | 644 |
648 void WebActivity::ShowContentProxy() { | 645 void WebActivity::ShowContentProxy() { |
649 if (!content_proxy_.get()) | 646 if (!content_proxy_.get()) |
650 content_proxy_.reset(new ContentProxy(web_view_)); | 647 content_proxy_.reset(new ContentProxy(web_view_)); |
651 } | 648 } |
652 | 649 |
653 } // namespace athena | 650 } // namespace athena |
OLD | NEW |