OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #include "chrome/browser/task_management/providers/web_contents/subframe_task.h" | |
6 | |
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 "ui/base/l10n/l10n_util.h" | |
14 | |
15 namespace task_management { | |
16 | |
17 namespace { | |
18 | |
19 base::string16 AdjustTitle(const content::SiteInstance* site_instance) { | |
20 DCHECK(site_instance); | |
21 int message_id = site_instance->GetBrowserContext()->IsOffTheRecord() ? | |
22 IDS_TASK_MANAGER_SUBFRAME_INCOGNITO_PREFIX : | |
23 IDS_TASK_MANAGER_SUBFRAME_PREFIX; | |
24 | |
25 return l10n_util::GetStringFUTF16(message_id, base::UTF8ToUTF16( | |
26 site_instance->GetSiteURL().spec())); | |
27 } | |
28 | |
29 } // namespace | |
30 | |
31 SubframeTask::SubframeTask(content::RenderFrameHost* render_frame_host) | |
32 : RendererTask(AdjustTitle(render_frame_host->GetSiteInstance()), | |
33 nullptr, | |
34 render_frame_host->GetProcess()->GetHandle(), | |
35 render_frame_host->GetProcess()) { | |
36 } | |
37 | |
38 SubframeTask::~SubframeTask() { | |
39 } | |
40 | |
41 void SubframeTask::OnTitleChanged(content::NavigationEntry* entry) { | |
ncarter (slow)
2015/05/13 16:53:18
May be worth adding a comment here explaining why
afakhry
2015/05/14 17:01:12
Done.
| |
42 } | |
43 | |
44 void SubframeTask::OnFaviconChanged() { | |
ncarter (slow)
2015/05/13 16:53:19
Same here.
afakhry
2015/05/14 17:01:12
Done.
| |
45 } | |
46 | |
47 } // namespace task_management | |
OLD | NEW |