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) { |
| 42 // This will be called when the title changes on the WebContents's main frame, |
| 43 // but this Task represents other frames, so we don't care. |
| 44 } |
| 45 |
| 46 void SubframeTask::OnFaviconChanged() { |
| 47 // This will be called when the favicon changes on the WebContents's main |
| 48 // frame, but this Task represents other frames, so we don't care. |
| 49 } |
| 50 |
| 51 } // namespace task_management |
OLD | NEW |