Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1814)

Unified Diff: athena/content/app_activity.cc

Issue 707603002: athena: Use ActivityList where appropriate, and fix AppActivity tests. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/content/app_activity.h ('k') | athena/content/app_activity_registry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « athena/content/app_activity.h ('k') | athena/content/app_activity_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698