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

Unified Diff: chrome/browser/ui/webui/task_manager_handler.cc

Issue 7550004: WebUI TaskManager: make it default on Chrome OS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move the initializing of observer before the loading. Created 9 years, 5 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/ui/webui/task_manager_dialog.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/task_manager_handler.cc
diff --git a/chrome/browser/ui/webui/task_manager_handler.cc b/chrome/browser/ui/webui/task_manager_handler.cc
index dd5ac7f7cc37c8ff855e831b50682e1f69a18132..03c90dd2acc108647e8728d88e17d26c7f7169be 100644
--- a/chrome/browser/ui/webui/task_manager_handler.cc
+++ b/chrome/browser/ui/webui/task_manager_handler.cc
@@ -11,6 +11,9 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/task_manager/task_manager.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/common/notification_service.h"
+#include "content/common/notification_source.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace {
@@ -244,6 +247,10 @@ void TaskManagerHandler::OnItemsAdded(const int start, const int length) {
}
void TaskManagerHandler::OnItemsRemoved(const int start, const int length) {
+ // Returns if this is called before updating |resource_to_group_table_|.
+ if (resource_to_group_table_.size() < static_cast<size_t>(start + length))
+ return;
+
// Converts from an index of resources to an index of groups.
int group_start = resource_to_group_table_[start];
int group_end = resource_to_group_table_[start + length - 1];
@@ -332,6 +339,11 @@ void TaskManagerHandler::EnableTaskManager(const ListValue* indexes) {
is_enabled_ = true;
model_->AddObserver(this);
model_->StartUpdating();
+
+ NotificationService::current()->Notify(
+ chrome::NOTIFICATION_TASK_MANAGER_WINDOW_READY,
+ Source<TaskManagerModel>(model_),
+ NotificationService::NoDetails());
}
void TaskManagerHandler::OpenAboutMemory(const ListValue* indexes) {
« no previous file with comments | « chrome/browser/ui/webui/task_manager_dialog.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698