Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5393)

Unified Diff: chrome/browser/task_management/providers/web_contents/subframe_task.cc

Issue 1137183002: New Task Manager - Phase 1.3.1.B: SubframeTask (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Nick's comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/task_management/providers/web_contents/subframe_task.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/task_management/providers/web_contents/subframe_task.cc
diff --git a/chrome/browser/task_management/providers/web_contents/subframe_task.cc b/chrome/browser/task_management/providers/web_contents/subframe_task.cc
new file mode 100644
index 0000000000000000000000000000000000000000..62e9af7b242d2c0e3a9880dd1f05a34eebf4156f
--- /dev/null
+++ b/chrome/browser/task_management/providers/web_contents/subframe_task.cc
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/task_management/providers/web_contents/subframe_task.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/grit/generated_resources.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/site_instance.h"
+#include "ui/base/l10n/l10n_util.h"
+
+namespace task_management {
+
+namespace {
+
+base::string16 AdjustTitle(const content::SiteInstance* site_instance) {
+ DCHECK(site_instance);
+ int message_id = site_instance->GetBrowserContext()->IsOffTheRecord() ?
+ IDS_TASK_MANAGER_SUBFRAME_INCOGNITO_PREFIX :
+ IDS_TASK_MANAGER_SUBFRAME_PREFIX;
+
+ return l10n_util::GetStringFUTF16(message_id, base::UTF8ToUTF16(
+ site_instance->GetSiteURL().spec()));
+}
+
+} // namespace
+
+SubframeTask::SubframeTask(content::RenderFrameHost* render_frame_host)
+ : RendererTask(AdjustTitle(render_frame_host->GetSiteInstance()),
+ nullptr,
+ render_frame_host->GetProcess()->GetHandle(),
+ render_frame_host->GetProcess()) {
+}
+
+SubframeTask::~SubframeTask() {
+}
+
+void SubframeTask::OnTitleChanged(content::NavigationEntry* entry) {
+ // This will be called when the title changes on the WebContents's main frame,
+ // but this Task represents other frames, so we don't care.
+}
+
+void SubframeTask::OnFaviconChanged() {
+ // This will be called when the favicon changes on the WebContents's main
+ // frame, but this Task represents other frames, so we don't care.
+}
+
+} // namespace task_management
« no previous file with comments | « chrome/browser/task_management/providers/web_contents/subframe_task.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698