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

Side by Side Diff: chrome/browser/extensions/api/runtime/runtime_api.cc

Issue 126163003: Rename setUninstallUrl to setUninstallURL throughout codebase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/api/runtime/runtime_api.h" 5 #include "chrome/browser/extensions/api/runtime/runtime_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 profile, extension_id, false)); 109 profile, extension_id, false));
110 return; 110 return;
111 } 111 }
112 112
113 scoped_ptr<base::ListValue> event_args(new base::ListValue()); 113 scoped_ptr<base::ListValue> event_args(new base::ListValue());
114 scoped_ptr<Event> event(new Event(runtime::OnStartup::kEventName, 114 scoped_ptr<Event> event(new Event(runtime::OnStartup::kEventName,
115 event_args.Pass())); 115 event_args.Pass()));
116 system->event_router()->DispatchEventToExtension(extension_id, event.Pass()); 116 system->event_router()->DispatchEventToExtension(extension_id, event.Pass());
117 } 117 }
118 118
119 void SetUninstallUrl(ExtensionPrefs* prefs, 119 void SetUninstallURL(ExtensionPrefs* prefs,
120 const std::string& extension_id, 120 const std::string& extension_id,
121 const std::string& url_string) { 121 const std::string& url_string) {
122 prefs->UpdateExtensionPref(extension_id, 122 prefs->UpdateExtensionPref(extension_id,
123 kUninstallUrl, 123 kUninstallUrl,
124 new base::StringValue(url_string)); 124 new base::StringValue(url_string));
125 } 125 }
126 126
127 #if defined(ENABLE_EXTENSIONS) 127 #if defined(ENABLE_EXTENSIONS)
128 std::string GetUninstallUrl(ExtensionPrefs* prefs, 128 std::string GetUninstallURL(ExtensionPrefs* prefs,
129 const std::string& extension_id) { 129 const std::string& extension_id) {
130 std::string url_string; 130 std::string url_string;
131 prefs->ReadPrefAsString(extension_id, kUninstallUrl, &url_string); 131 prefs->ReadPrefAsString(extension_id, kUninstallUrl, &url_string);
132 return url_string; 132 return url_string;
133 } 133 }
134 #endif // defined(ENABLE_EXTENSIONS) 134 #endif // defined(ENABLE_EXTENSIONS)
135 135
136 } // namespace 136 } // namespace
137 137
138 /////////////////////////////////////////////////////////////////////////////// 138 ///////////////////////////////////////////////////////////////////////////////
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 341
342 DCHECK(system->event_router()); 342 DCHECK(system->event_router());
343 system->event_router()->DispatchEventToExtension(app_id, event.Pass()); 343 system->event_router()->DispatchEventToExtension(app_id, event.Pass());
344 } 344 }
345 345
346 // static 346 // static
347 void RuntimeEventRouter::OnExtensionUninstalled( 347 void RuntimeEventRouter::OnExtensionUninstalled(
348 Profile* profile, 348 Profile* profile,
349 const std::string& extension_id) { 349 const std::string& extension_id) {
350 #if defined(ENABLE_EXTENSIONS) 350 #if defined(ENABLE_EXTENSIONS)
351 GURL uninstall_url(GetUninstallUrl(ExtensionPrefs::Get(profile), 351 GURL uninstall_url(GetUninstallURL(ExtensionPrefs::Get(profile),
352 extension_id)); 352 extension_id));
353 353
354 if (uninstall_url.is_empty()) 354 if (uninstall_url.is_empty())
355 return; 355 return;
356 356
357 Browser* browser = chrome::FindLastActiveWithProfile(profile, 357 Browser* browser = chrome::FindLastActiveWithProfile(profile,
358 chrome::GetActiveDesktop()); 358 chrome::GetActiveDesktop());
359 if (!browser) 359 if (!browser)
360 browser = new Browser(Browser::CreateParams(profile, 360 browser = new Browser(Browser::CreateParams(profile,
361 chrome::GetActiveDesktop())); 361 chrome::GetActiveDesktop()));
(...skipping 28 matching lines...) Expand all
390 390
391 void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost* host) { 391 void RuntimeGetBackgroundPageFunction::OnPageLoaded(ExtensionHost* host) {
392 if (host) { 392 if (host) {
393 SendResponse(true); 393 SendResponse(true);
394 } else { 394 } else {
395 error_ = kPageLoadError; 395 error_ = kPageLoadError;
396 SendResponse(false); 396 SendResponse(false);
397 } 397 }
398 } 398 }
399 399
400 bool RuntimeSetUninstallUrlFunction::RunImpl() { 400 bool RuntimeSetUninstallURLFunction::RunImpl() {
401 std::string url_string; 401 std::string url_string;
402 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url_string)); 402 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url_string));
403 403
404 GURL url(url_string); 404 GURL url(url_string);
405 if (!url.is_valid()) { 405 if (!url.is_valid()) {
406 error_ = ErrorUtils::FormatErrorMessage(kInvalidUrlError, url_string); 406 error_ = ErrorUtils::FormatErrorMessage(kInvalidUrlError, url_string);
407 return false; 407 return false;
408 } 408 }
409 409
410 SetUninstallUrl( 410 SetUninstallURL(
411 ExtensionPrefs::Get(GetProfile()), extension_id(), url_string); 411 ExtensionPrefs::Get(GetProfile()), extension_id(), url_string);
412 return true; 412 return true;
413 } 413 }
414 414
415 bool RuntimeReloadFunction::RunImpl() { 415 bool RuntimeReloadFunction::RunImpl() {
416 // We can't call ReloadExtension directly, since when this method finishes 416 // We can't call ReloadExtension directly, since when this method finishes
417 // it tries to decrease the reference count for the extension, which fails 417 // it tries to decrease the reference count for the extension, which fails
418 // if the extension has already been reloaded; so instead we post a task. 418 // if the extension has already been reloaded; so instead we post a task.
419 base::MessageLoop::current()->PostTask( 419 base::MessageLoop::current()->PostTask(
420 FROM_HERE, 420 FROM_HERE,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 content::ChildProcessSecurityPolicy::GetInstance(); 573 content::ChildProcessSecurityPolicy::GetInstance();
574 policy->GrantReadFileSystem(renderer_id, filesystem_id); 574 policy->GrantReadFileSystem(renderer_id, filesystem_id);
575 base::DictionaryValue* dict = new base::DictionaryValue(); 575 base::DictionaryValue* dict = new base::DictionaryValue();
576 SetResult(dict); 576 SetResult(dict);
577 dict->SetString("fileSystemId", filesystem_id); 577 dict->SetString("fileSystemId", filesystem_id);
578 dict->SetString("baseName", relative_path); 578 dict->SetString("baseName", relative_path);
579 return true; 579 return true;
580 } 580 }
581 581
582 } // namespace extensions 582 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/runtime/runtime_api.h ('k') | chrome/browser/extensions/api/runtime/runtime_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698