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/subframe_task.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/grit/generated_resources.h"
9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/render_frame_host.h"
11 #include "content/public/browser/render_process_host.h"
12 #include "content/public/browser/site_instance.h"
13 #include "content/public/browser/web_contents.h"
14 #include "ui/base/l10n/l10n_util.h"
16 namespace task_management
{
20 base::string16
AdjustTitle(const content::SiteInstance
* site_instance
) {
21 DCHECK(site_instance
);
22 int message_id
= site_instance
->GetBrowserContext()->IsOffTheRecord() ?
23 IDS_TASK_MANAGER_SUBFRAME_INCOGNITO_PREFIX
:
24 IDS_TASK_MANAGER_SUBFRAME_PREFIX
;
26 return l10n_util::GetStringFUTF16(message_id
, base::UTF8ToUTF16(
27 site_instance
->GetSiteURL().spec()));
32 SubframeTask::SubframeTask(content::RenderFrameHost
* render_frame_host
,
33 content::WebContents
* web_contents
)
34 : RendererTask(AdjustTitle(render_frame_host
->GetSiteInstance()),
37 render_frame_host
->GetProcess()) {
38 // Note that we didn't get the RenderProcessHost from the WebContents, but
39 // rather from the RenderFrameHost. Out-of-process iframes reside on
40 // different processes than that of their main frame.
43 SubframeTask::~SubframeTask() {
46 void SubframeTask::UpdateTitle() {
47 // This will be called when the title changes on the WebContents's main frame,
48 // but this Task represents other frames, so we don't care.
51 void SubframeTask::UpdateFavicon() {
52 // This will be called when the favicon changes on the WebContents's main
53 // frame, but this Task represents other frames, so we don't care.
56 } // namespace task_management