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

Side by Side Diff: chrome/browser/task_manager_resource_providers.cc

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/task_manager_resource_providers.h" 5 #include "chrome/browser/task_manager_resource_providers.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 ExtensionHost* extension_host) 522 ExtensionHost* extension_host)
523 : extension_host_(extension_host) { 523 : extension_host_(extension_host) {
524 if (!default_icon_) { 524 if (!default_icon_) {
525 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 525 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
526 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); 526 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN);
527 } 527 }
528 process_handle_ = extension_host_->render_process_host()->GetHandle(); 528 process_handle_ = extension_host_->render_process_host()->GetHandle();
529 pid_ = base::GetProcId(process_handle_); 529 pid_ = base::GetProcId(process_handle_);
530 std::wstring extension_name(UTF8ToWide(GetExtension()->name())); 530 std::wstring extension_name(UTF8ToWide(GetExtension()->name()));
531 DCHECK(!extension_name.empty()); 531 DCHECK(!extension_name.empty());
532 title_ = l10n_util::GetStringF(IDS_TASK_MANAGER_EXTENSION_PREFIX, 532
533 extension_name); 533 int message_id =
534 GetExtension()->is_app() ?
535 (extension_host_->profile()->IsOffTheRecord() ?
536 IDS_TASK_MANAGER_APP_INCOGNITO_PREFIX :
537 IDS_TASK_MANAGER_APP_PREFIX) :
538 (extension_host_->profile()->IsOffTheRecord() ?
539 IDS_TASK_MANAGER_EXTENSION_INCOGNITO_PREFIX :
540 IDS_TASK_MANAGER_EXTENSION_PREFIX);
541 title_ = l10n_util::GetStringF(message_id, extension_name);
534 } 542 }
535 543
536 TaskManagerExtensionProcessResource::~TaskManagerExtensionProcessResource() { 544 TaskManagerExtensionProcessResource::~TaskManagerExtensionProcessResource() {
537 } 545 }
538 546
539 std::wstring TaskManagerExtensionProcessResource::GetTitle() const { 547 std::wstring TaskManagerExtensionProcessResource::GetTitle() const {
540 return title_; 548 return title_;
541 } 549 }
542 550
543 SkBitmap TaskManagerExtensionProcessResource::GetIcon() const { 551 SkBitmap TaskManagerExtensionProcessResource::GetIcon() const {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 587 }
580 588
581 void TaskManagerExtensionProcessResourceProvider::StartUpdating() { 589 void TaskManagerExtensionProcessResourceProvider::StartUpdating() {
582 DCHECK(!updating_); 590 DCHECK(!updating_);
583 updating_ = true; 591 updating_ = true;
584 592
585 // Add all the existing ExtensionHosts. 593 // Add all the existing ExtensionHosts.
586 ProfileManager* profile_manager = g_browser_process->profile_manager(); 594 ProfileManager* profile_manager = g_browser_process->profile_manager();
587 for (ProfileManager::const_iterator it = profile_manager->begin(); 595 for (ProfileManager::const_iterator it = profile_manager->begin();
588 it != profile_manager->end(); ++it) { 596 it != profile_manager->end(); ++it) {
589 ExtensionProcessManager* process_manager = 597 ExtensionProcessManager* process_manager =
590 (*it)->GetExtensionProcessManager(); 598 (*it)->GetExtensionProcessManager();
591 if (!process_manager) 599 if (process_manager) {
592 continue;
593 ExtensionProcessManager::const_iterator jt; 600 ExtensionProcessManager::const_iterator jt;
594 for (jt = process_manager->begin(); jt != process_manager->end(); ++jt) 601 for (jt = process_manager->begin(); jt != process_manager->end(); ++jt)
595 AddToTaskManager(*jt); 602 AddToTaskManager(*jt);
603 }
604
605 // If we have an incognito profile active, include the split-mode incognito
606 // extensions.
607 if (BrowserList::IsOffTheRecordSessionActive()) {
608 ExtensionProcessManager* process_manager =
609 (*it)->GetOffTheRecordProfile()->GetExtensionProcessManager();
610 if (process_manager) {
611 ExtensionProcessManager::const_iterator jt;
612 for (jt = process_manager->begin(); jt != process_manager->end(); ++jt)
613 AddToTaskManager(*jt);
614 }
615 }
596 } 616 }
597 617
598 // Register for notifications about extension process changes. 618 // Register for notifications about extension process changes.
599 registrar_.Add(this, NotificationType::EXTENSION_PROCESS_CREATED, 619 registrar_.Add(this, NotificationType::EXTENSION_PROCESS_CREATED,
600 NotificationService::AllSources()); 620 NotificationService::AllSources());
601 registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED, 621 registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED,
602 NotificationService::AllSources()); 622 NotificationService::AllSources());
603 registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED, 623 registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED,
604 NotificationService::AllSources()); 624 NotificationService::AllSources());
605 } 625 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 926
907 return &resource_; 927 return &resource_;
908 } 928 }
909 929
910 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { 930 void TaskManagerBrowserProcessResourceProvider::StartUpdating() {
911 task_manager_->AddResource(&resource_); 931 task_manager_->AddResource(&resource_);
912 } 932 }
913 933
914 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { 934 void TaskManagerBrowserProcessResourceProvider::StopUpdating() {
915 } 935 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/extensions_ui.html ('k') | chrome/browser/views/location_bar/icon_label_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698