Index: athena/content/app_activity.cc |
diff --git a/athena/content/app_activity.cc b/athena/content/app_activity.cc |
index b8b1c5fa22037a7bf7134f70ef64d48a3ba723f0..cef358e043e2e6f417c66c2bbecaa2308016b569 100644 |
--- a/athena/content/app_activity.cc |
+++ b/athena/content/app_activity.cc |
@@ -78,7 +78,7 @@ void AppActivity::SetCurrentState(Activity::ActivityState state) { |
} |
Activity::ActivityState AppActivity::GetCurrentState() { |
- DCHECK(web_view_ || ACTIVITY_UNLOADED == current_state_); |
+ DCHECK(GetContentsView() || ACTIVITY_UNLOADED == current_state_); |
return current_state_; |
} |
@@ -95,9 +95,9 @@ Activity::ActivityMediaState AppActivity::GetMediaState() { |
} |
aura::Window* AppActivity::GetWindow() { |
- return web_view_ && web_view_->GetWidget() |
- ? web_view_->GetWidget()->GetNativeWindow() |
- : nullptr; |
+ views::View* view = GetContentsView(); |
+ return (view && view->GetWidget()) ? view->GetWidget()->GetNativeWindow() |
+ : nullptr; |
} |
content::WebContents* AppActivity::GetWebContents() { |
@@ -161,7 +161,7 @@ SkColor AppActivity::GetRepresentativeColor() const { |
} |
base::string16 AppActivity::GetTitle() const { |
- return web_view_->GetWebContents()->GetTitle(); |
+ return web_view_ ? web_view_->GetWebContents()->GetTitle() : base::string16(); |
} |
gfx::ImageSkia AppActivity::GetIcon() const { |
@@ -233,11 +233,12 @@ void AppActivity::DidUpdateFaviconURL( |
// Note: This should only get called once for an |app_window| of the |
// |activity|. |
void AppActivity::RegisterActivity() { |
- content::WebContents* web_contents = web_view_->GetWebContents(); |
+ content::WebContents* web_contents = web_view_ ? web_view_->GetWebContents() |
+ : nullptr; |
AppRegistry* app_registry = AppRegistry::Get(); |
// Get the application's registry. |
app_activity_registry_ = app_registry->GetAppActivityRegistry( |
- app_id_, web_contents->GetBrowserContext()); |
+ app_id_, web_contents ? web_contents->GetBrowserContext() : nullptr); |
DCHECK(app_activity_registry_); |
// Register the activity. |
app_activity_registry_->RegisterAppActivity(this); |