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 "content/public/browser/native_web_keyboard_event.h" | 10 #include "content/public/browser/native_web_keyboard_event.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 return Activity::ACTIVITY_MEDIA_STATE_NONE; | 342 return Activity::ACTIVITY_MEDIA_STATE_NONE; |
343 } | 343 } |
344 | 344 |
345 void WebActivity::Init() { | 345 void WebActivity::Init() { |
346 DCHECK(web_view_); | 346 DCHECK(web_view_); |
347 web_view_->InstallAccelerators(); | 347 web_view_->InstallAccelerators(); |
348 } | 348 } |
349 | 349 |
350 SkColor WebActivity::GetRepresentativeColor() const { | 350 SkColor WebActivity::GetRepresentativeColor() const { |
351 // TODO(sad): Compute the color from the favicon. | 351 // TODO(sad): Compute the color from the favicon. |
352 return SK_ColorGRAY; | 352 return web_view_ ? SK_ColorGRAY : SkColorSetRGB(0xbb, 0x77, 0x77); |
353 } | 353 } |
354 | 354 |
355 base::string16 WebActivity::GetTitle() const { | 355 base::string16 WebActivity::GetTitle() const { |
356 return web_view_->GetWebContents()->GetTitle(); | 356 return web_view_ ? web_view_->GetWebContents()->GetTitle() : base::string16(); |
357 } | 357 } |
358 | 358 |
359 bool WebActivity::UsesFrame() const { | 359 bool WebActivity::UsesFrame() const { |
360 return true; | 360 return true; |
361 } | 361 } |
362 | 362 |
363 views::View* WebActivity::GetContentsView() { | 363 views::View* WebActivity::GetContentsView() { |
364 if (!web_view_) { | 364 if (!web_view_) { |
365 web_view_ = new AthenaWebView(browser_context_); | 365 web_view_ = new AthenaWebView(browser_context_); |
366 web_view_->LoadInitialURL(url_); | 366 web_view_->LoadInitialURL(url_); |
(...skipping 16 matching lines...) Expand all Loading... |
383 bool explicit_set) { | 383 bool explicit_set) { |
384 ActivityManager::Get()->UpdateActivity(this); | 384 ActivityManager::Get()->UpdateActivity(this); |
385 } | 385 } |
386 | 386 |
387 void WebActivity::DidUpdateFaviconURL( | 387 void WebActivity::DidUpdateFaviconURL( |
388 const std::vector<content::FaviconURL>& candidates) { | 388 const std::vector<content::FaviconURL>& candidates) { |
389 ActivityManager::Get()->UpdateActivity(this); | 389 ActivityManager::Get()->UpdateActivity(this); |
390 } | 390 } |
391 | 391 |
392 } // namespace athena | 392 } // namespace athena |
OLD | NEW |