BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / task_management / providers / web_contents / guest_task.cc
blobbf092cbbe190a032b4adbc9781aa6b055fc6084c
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/task_management/providers/web_contents/guest_task.h"
7 #include "components/guest_view/browser/guest_view_base.h"
8 #include "content/public/browser/web_contents.h"
9 #include "ui/base/l10n/l10n_util.h"
11 namespace task_management {
13 GuestTask::GuestTask(content::WebContents* web_contents)
14 : RendererTask(GetCurrentTitle(web_contents),
15 GetFaviconFromWebContents(web_contents),
16 web_contents,
17 web_contents->GetRenderProcessHost()) {
20 GuestTask::~GuestTask() {
23 void GuestTask::UpdateTitle() {
24 set_title(GetCurrentTitle(web_contents()));
27 void GuestTask::UpdateFavicon() {
28 const gfx::ImageSkia* icon = GetFaviconFromWebContents(web_contents());
29 set_icon(icon ? *icon : gfx::ImageSkia());
32 Task::Type GuestTask::GetType() const {
33 return Task::GUEST;
36 base::string16 GuestTask::GetCurrentTitle(
37 content::WebContents* web_contents) const {
38 DCHECK(web_contents);
40 guest_view::GuestViewBase* guest =
41 guest_view::GuestViewBase::FromWebContents(web_contents);
43 DCHECK(guest);
45 base::string16 title =
46 l10n_util::GetStringFUTF16(guest->GetTaskPrefix(),
47 RendererTask::GetTitleFromWebContents(
48 web_contents));
50 return title;
53 } // namespace task_management