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

Side by Side Diff: chrome/browser/ui/webui/options/extension_settings_handler.cc

Issue 8353022: [web-ui settings] Fixes and improvements for settings page searching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Review tweaks Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/options/extension_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/extension_settings_handler.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 content::Source<Profile>(profile)); 208 content::Source<Profile>(profile));
209 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED, 209 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED,
210 content::Source<Profile>(profile)); 210 content::Source<Profile>(profile));
211 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 211 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
212 content::Source<Profile>(profile)); 212 content::Source<Profile>(profile));
213 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, 213 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
214 content::Source<Profile>(profile)); 214 content::Source<Profile>(profile));
215 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED, 215 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED,
216 content::Source<Profile>(profile)); 216 content::Source<Profile>(profile));
217 registrar_.Add(this, 217 registrar_.Add(this,
218 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
219 NotificationService::AllBrowserContextsAndSources());
220 registrar_.Add(this,
221 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, 218 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED,
222 NotificationService::AllBrowserContextsAndSources()); 219 NotificationService::AllBrowserContextsAndSources());
223 registrar_.Add(this, 220 registrar_.Add(this,
224 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, 221 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED,
225 NotificationService::AllBrowserContextsAndSources()); 222 NotificationService::AllBrowserContextsAndSources());
226 registrar_.Add(this, 223 registrar_.Add(this,
227 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, 224 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED,
228 NotificationService::AllBrowserContextsAndSources()); 225 NotificationService::AllBrowserContextsAndSources());
229 registrar_.Add(this, 226 registrar_.Add(this,
230 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, 227 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED,
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 void ExtensionSettingsHandler::MultiFilesSelected( 492 void ExtensionSettingsHandler::MultiFilesSelected(
496 const std::vector<FilePath>& files, void* params) { 493 const std::vector<FilePath>& files, void* params) {
497 NOTREACHED(); 494 NOTREACHED();
498 } 495 }
499 496
500 void ExtensionSettingsHandler::GetLocalizedValues( 497 void ExtensionSettingsHandler::GetLocalizedValues(
501 DictionaryValue* localized_strings) { 498 DictionaryValue* localized_strings) {
502 DCHECK(localized_strings); 499 DCHECK(localized_strings);
503 500
504 RegisterTitle(localized_strings, "extensionSettings", 501 RegisterTitle(localized_strings, "extensionSettings",
505 IDS_OPTIONS_GENERAL_TAB_LABEL); 502 IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE);
506 503
507 localized_strings->SetString("extensionSettingsTitle",
508 l10n_util::GetStringUTF16(IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE));
509 localized_strings->SetString("extensionSettingsVisitWebsite", 504 localized_strings->SetString("extensionSettingsVisitWebsite",
510 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); 505 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE));
511 506
512 localized_strings->SetString("extensionSettingsDeveloperMode", 507 localized_strings->SetString("extensionSettingsDeveloperMode",
513 l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEVELOPER_MODE_LINK)); 508 l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEVELOPER_MODE_LINK));
514 localized_strings->SetString("extensionSettingsNoExtensions", 509 localized_strings->SetString("extensionSettingsNoExtensions",
515 l10n_util::GetStringUTF16(IDS_EXTENSIONS_NONE_INSTALLED)); 510 l10n_util::GetStringUTF16(IDS_EXTENSIONS_NONE_INSTALLED));
516 localized_strings->SetString("extensionSettingsSuggestGallery", 511 localized_strings->SetString("extensionSettingsSuggestGallery",
517 l10n_util::GetStringFUTF16(IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY, 512 l10n_util::GetStringFUTF16(IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY,
518 ASCIIToUTF16("<a href='") + 513 ASCIIToUTF16("<a href='") +
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 const content::NotificationSource& source, 584 const content::NotificationSource& source,
590 const content::NotificationDetails& details) { 585 const content::NotificationDetails& details) {
591 Profile* profile = Profile::FromWebUI(web_ui_); 586 Profile* profile = Profile::FromWebUI(web_ui_);
592 Profile* source_profile = NULL; 587 Profile* source_profile = NULL;
593 switch (type) { 588 switch (type) {
594 // We listen for notifications that will result in the page being 589 // We listen for notifications that will result in the page being
595 // repopulated with data twice for the same event in certain cases. 590 // repopulated with data twice for the same event in certain cases.
596 // For instance, EXTENSION_LOADED & EXTENSION_PROCESS_CREATED because 591 // For instance, EXTENSION_LOADED & EXTENSION_PROCESS_CREATED because
597 // we don't know about the views for an extension at EXTENSION_LOADED, but 592 // we don't know about the views for an extension at EXTENSION_LOADED, but
598 // if we only listen to EXTENSION_PROCESS_CREATED, we'll miss extensions 593 // if we only listen to EXTENSION_PROCESS_CREATED, we'll miss extensions
599 // that don't have a process at startup. Similarly, NAV_ENTRY_COMMITTED & 594 // that don't have a process at startup.
600 // RENDER_VIEW_HOST_CREATED because we want to handle both
601 // the case of navigating from a non-extension page to an extension page in
602 // a TabContents (which will generate NAV_ENTRY_COMMITTED) as well as
603 // extension content being shown in popups and balloons (which will generate
604 // RENDER_VIEW_HOST_CREATED but no NAV_ENTRY_COMMITTED).
605 // 595 //
606 // Doing it this way gets everything but causes the page to be rendered 596 // Doing it this way gets everything but causes the page to be rendered
607 // more than we need. It doesn't seem to result in any noticeable flicker. 597 // more than we need. It doesn't seem to result in any noticeable flicker.
608 case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: 598 case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED:
609 deleting_rvh_ = content::Source<RenderViewHost>(source).ptr(); 599 deleting_rvh_ = content::Source<RenderViewHost>(source).ptr();
610 // Fall through. 600 // Fall through.
611 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED: 601 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED:
612 source_profile = Profile::FromBrowserContext( 602 source_profile = Profile::FromBrowserContext(
613 content::Source<RenderViewHost>(source)->site_instance()-> 603 content::Source<RenderViewHost>(source)->site_instance()->
614 browsing_instance()->browser_context()); 604 browsing_instance()->browser_context());
615 if (!profile->IsSameProfile(source_profile)) 605 if (!profile->IsSameProfile(source_profile))
616 return; 606 return;
617 MaybeUpdateAfterNotification(); 607 MaybeUpdateAfterNotification();
618 break; 608 break;
619 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED: 609 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED:
620 deleting_rvh_ = 610 deleting_rvh_ =
621 content::Details<BackgroundContents>(details)->render_view_host(); 611 content::Details<BackgroundContents>(details)->render_view_host();
622 // Fall through. 612 // Fall through.
623 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED: 613 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED:
624 source_profile = content::Source<Profile>(source).ptr(); 614 source_profile = content::Source<Profile>(source).ptr();
625 if (!profile->IsSameProfile(source_profile)) 615 if (!profile->IsSameProfile(source_profile))
626 return; 616 return;
627 MaybeUpdateAfterNotification(); 617 MaybeUpdateAfterNotification();
628 break; 618 break;
629 case content::NOTIFICATION_NAV_ENTRY_COMMITTED:
630 source_profile = Profile::FromBrowserContext(
631 content::Source<NavigationController>(
632 source).ptr()->browser_context());
633 if (!profile->IsSameProfile(source_profile))
634 return;
635 MaybeUpdateAfterNotification();
636 break;
637 case chrome::NOTIFICATION_EXTENSION_LOADED: 619 case chrome::NOTIFICATION_EXTENSION_LOADED:
638 case chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED: 620 case chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED:
639 case chrome::NOTIFICATION_EXTENSION_UNLOADED: 621 case chrome::NOTIFICATION_EXTENSION_UNLOADED:
640 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: 622 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED:
641 case chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED: 623 case chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED:
642 case chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: 624 case chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED:
643 MaybeUpdateAfterNotification(); 625 MaybeUpdateAfterNotification();
644 break; 626 break;
645 default: 627 default:
646 NOTREACHED(); 628 NOTREACHED();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 continue; 782 continue;
801 } else if (!extension->web_extent().MatchesURL(url)) { 783 } else if (!extension->web_extent().MatchesURL(url)) {
802 continue; 784 continue;
803 } 785 }
804 786
805 result->push_back( 787 result->push_back(
806 ExtensionPage(url, process->id(), host->routing_id(), 788 ExtensionPage(url, process->id(), host->routing_id(),
807 process->browser_context()->IsOffTheRecord())); 789 process->browser_context()->IsOffTheRecord()));
808 } 790 }
809 } 791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698