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

Side by Side Diff: chrome/browser/extensions/extensions_ui.cc

Issue 7554008: Removal of Profile from content part 6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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/extensions/extensions_ui.h" 5 #include "chrome/browser/extensions/extensions_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (ShouldShowExtension(*extension)) { 235 if (ShouldShowExtension(*extension)) {
236 extensions_list->Append(CreateExtensionDetailValue( 236 extensions_list->Append(CreateExtensionDetailValue(
237 extension_service_, 237 extension_service_,
238 *extension, 238 *extension,
239 empty_pages, // Terminated process has no active pages. 239 empty_pages, // Terminated process has no active pages.
240 false, true)); // enabled, terminated 240 false, true)); // enabled, terminated
241 } 241 }
242 } 242 }
243 results.Set("extensions", extensions_list); 243 results.Set("extensions", extensions_list);
244 244
245 bool developer_mode = web_ui_->GetProfile()->GetPrefs() 245 Profile* profile =
246 ->GetBoolean(prefs::kExtensionsUIDeveloperMode); 246 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
247 bool developer_mode =
248 profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
247 results.SetBoolean("developerMode", developer_mode); 249 results.SetBoolean("developerMode", developer_mode);
248 250
249 web_ui_->CallJavascriptFunction("returnExtensionsData", results); 251 web_ui_->CallJavascriptFunction("returnExtensionsData", results);
250 } 252 }
251 253
252 void ExtensionsDOMHandler::RegisterForNotifications() { 254 void ExtensionsDOMHandler::RegisterForNotifications() {
253 // Register for notifications that we need to reload the page. 255 // Register for notifications that we need to reload the page.
254 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 256 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
255 NotificationService::AllSources()); 257 NotificationService::AllSources());
256 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED, 258 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED,
(...skipping 17 matching lines...) Expand all
274 registrar_.Add(this, 276 registrar_.Add(this,
275 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, 277 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED,
276 NotificationService::AllSources()); 278 NotificationService::AllSources());
277 registrar_.Add(this, 279 registrar_.Add(this,
278 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, 280 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED,
279 NotificationService::AllSources()); 281 NotificationService::AllSources());
280 } 282 }
281 283
282 ExtensionUninstallDialog* ExtensionsDOMHandler::GetExtensionUninstallDialog() { 284 ExtensionUninstallDialog* ExtensionsDOMHandler::GetExtensionUninstallDialog() {
283 if (!extension_uninstall_dialog_.get()) { 285 if (!extension_uninstall_dialog_.get()) {
286 Profile* profile =
287 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
284 extension_uninstall_dialog_.reset( 288 extension_uninstall_dialog_.reset(
285 new ExtensionUninstallDialog(web_ui_->GetProfile())); 289 new ExtensionUninstallDialog(profile));
286 } 290 }
287 return extension_uninstall_dialog_.get(); 291 return extension_uninstall_dialog_.get();
288 } 292 }
289 293
290 void ExtensionsDOMHandler::HandleToggleDeveloperMode(const ListValue* args) { 294 void ExtensionsDOMHandler::HandleToggleDeveloperMode(const ListValue* args) {
291 bool developer_mode = web_ui_->GetProfile()->GetPrefs() 295 Profile* profile =
292 ->GetBoolean(prefs::kExtensionsUIDeveloperMode); 296 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
293 web_ui_->GetProfile()->GetPrefs()->SetBoolean( 297 bool developer_mode =
294 prefs::kExtensionsUIDeveloperMode, !developer_mode); 298 profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
299 profile->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode,
300 !developer_mode);
295 } 301 }
296 302
297 void ExtensionsDOMHandler::HandleInspectMessage(const ListValue* args) { 303 void ExtensionsDOMHandler::HandleInspectMessage(const ListValue* args) {
298 std::string render_process_id_str; 304 std::string render_process_id_str;
299 std::string render_view_id_str; 305 std::string render_view_id_str;
300 int render_process_id; 306 int render_process_id;
301 int render_view_id; 307 int render_view_id;
302 CHECK(args->GetSize() == 2); 308 CHECK(args->GetSize() == 2);
303 CHECK(args->GetString(0, &render_process_id_str)); 309 CHECK(args->GetString(0, &render_process_id_str));
304 CHECK(args->GetString(1, &render_view_id_str)); 310 CHECK(args->GetString(1, &render_view_id_str));
(...skipping 25 matching lines...) Expand all
330 DCHECK(extension); 336 DCHECK(extension);
331 if (!Extension::UserMayDisable(extension->location())) { 337 if (!Extension::UserMayDisable(extension->location())) {
332 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was" 338 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was"
333 << "made. Extension id: " << extension->id(); 339 << "made. Extension id: " << extension->id();
334 return; 340 return;
335 } 341 }
336 342
337 if (enable_str == "true") { 343 if (enable_str == "true") {
338 ExtensionPrefs* prefs = extension_service_->extension_prefs(); 344 ExtensionPrefs* prefs = extension_service_->extension_prefs();
339 if (prefs->DidExtensionEscalatePermissions(extension_id)) { 345 if (prefs->DidExtensionEscalatePermissions(extension_id)) {
340 ShowExtensionDisabledDialog(extension_service_, 346 Profile* profile = Profile::FromBrowserContext(
341 web_ui_->GetProfile(), extension); 347 web_ui_->tab_contents()->browser_context());
348 ShowExtensionDisabledDialog(extension_service_, profile, extension);
342 } else { 349 } else {
343 extension_service_->EnableExtension(extension_id); 350 extension_service_->EnableExtension(extension_id);
344 } 351 }
345 } else { 352 } else {
346 extension_service_->DisableExtension(extension_id); 353 extension_service_->DisableExtension(extension_id);
347 } 354 }
348 } 355 }
349 356
350 void ExtensionsDOMHandler::HandleEnableIncognitoMessage(const ListValue* args) { 357 void ExtensionsDOMHandler::HandleEnableIncognitoMessage(const ListValue* args) {
351 CHECK(args->GetSize() == 2); 358 CHECK(args->GetSize() == 2);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 450 }
444 451
445 void ExtensionsDOMHandler::ExtensionDialogCanceled() { 452 void ExtensionsDOMHandler::ExtensionDialogCanceled() {
446 extension_id_prompting_ = ""; 453 extension_id_prompting_ = "";
447 } 454 }
448 455
449 void ExtensionsDOMHandler::HandleOptionsMessage(const ListValue* args) { 456 void ExtensionsDOMHandler::HandleOptionsMessage(const ListValue* args) {
450 const Extension* extension = GetExtension(args); 457 const Extension* extension = GetExtension(args);
451 if (!extension || extension->options_url().is_empty()) 458 if (!extension || extension->options_url().is_empty())
452 return; 459 return;
453 web_ui_->GetProfile()->GetExtensionProcessManager()->OpenOptionsPage( 460 Profile* profile =
454 extension, NULL); 461 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context());
462 profile->GetExtensionProcessManager()->OpenOptionsPage(extension, NULL);
455 } 463 }
456 464
457 void ExtensionsDOMHandler::HandleShowButtonMessage(const ListValue* args) { 465 void ExtensionsDOMHandler::HandleShowButtonMessage(const ListValue* args) {
458 const Extension* extension = GetExtension(args); 466 const Extension* extension = GetExtension(args);
459 extension_service_->SetBrowserActionVisibility(extension, true); 467 extension_service_->SetBrowserActionVisibility(extension, true);
460 } 468 }
461 469
462 void ExtensionsDOMHandler::HandleLoadMessage(const ListValue* args) { 470 void ExtensionsDOMHandler::HandleLoadMessage(const ListValue* args) {
463 FilePath::StringType string_path; 471 FilePath::StringType string_path;
464 CHECK(args->GetSize() == 1) << args->GetSize(); 472 CHECK(args->GetSize() == 1) << args->GetSize();
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 return ResourceBundle::GetSharedInstance(). 804 return ResourceBundle::GetSharedInstance().
797 LoadDataResourceBytes(IDR_PLUGIN); 805 LoadDataResourceBytes(IDR_PLUGIN);
798 } 806 }
799 807
800 // static 808 // static
801 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) { 809 void ExtensionsUI::RegisterUserPrefs(PrefService* prefs) {
802 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, 810 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode,
803 false, 811 false,
804 PrefService::SYNCABLE_PREF); 812 PrefService::SYNCABLE_PREF);
805 } 813 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/cloud_print/cloud_print_setup_flow.h » ('j') | chrome/browser/ui/webui/history_ui.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698