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

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

Issue 61323002: Fix broken threading model in CheckDesktopNotificationPermission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more merge conflicts.. Created 7 years, 1 month 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) 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/extension_system.h" 5 #include "chrome/browser/extensions/extension_system.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 28 matching lines...) Expand all
39 #include "chrome/common/extensions/extension.h" 39 #include "chrome/common/extensions/extension.h"
40 #include "chrome/common/extensions/features/feature_channel.h" 40 #include "chrome/common/extensions/features/feature_channel.h"
41 #include "content/public/browser/browser_thread.h" 41 #include "content/public/browser/browser_thread.h"
42 #include "content/public/browser/url_data_source.h" 42 #include "content/public/browser/url_data_source.h"
43 #include "extensions/browser/info_map.h" 43 #include "extensions/browser/info_map.h"
44 #include "extensions/browser/lazy_background_task_queue.h" 44 #include "extensions/browser/lazy_background_task_queue.h"
45 #include "extensions/browser/process_manager.h" 45 #include "extensions/browser/process_manager.h"
46 #include "extensions/common/constants.h" 46 #include "extensions/common/constants.h"
47 #include "extensions/common/manifest.h" 47 #include "extensions/common/manifest.h"
48 48
49 #if defined(ENABLE_NOTIFICATIONS)
50 #include "chrome/browser/notifications/desktop_notification_service.h"
51 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
52 #include "ui/message_center/notifier_settings.h"
53 #endif
54
49 #if defined(OS_CHROMEOS) 55 #if defined(OS_CHROMEOS)
50 #include "chrome/browser/app_mode/app_mode_utils.h" 56 #include "chrome/browser/app_mode/app_mode_utils.h"
51 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol icy_provider.h" 57 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol icy_provider.h"
52 #include "chrome/browser/chromeos/login/user.h" 58 #include "chrome/browser/chromeos/login/user.h"
53 #include "chrome/browser/chromeos/login/user_manager.h" 59 #include "chrome/browser/chromeos/login/user_manager.h"
54 #include "chrome/browser/chromeos/policy/device_local_account.h" 60 #include "chrome/browser/chromeos/policy/device_local_account.h"
55 #include "chromeos/chromeos_switches.h" 61 #include "chromeos/chromeos_switches.h"
56 #include "chromeos/login/login_state.h" 62 #include "chromeos/login/login_state.h"
57 #endif 63 #endif
58 64
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 396
391 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( 397 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts(
392 const Extension* extension) { 398 const Extension* extension) {
393 base::Time install_time; 399 base::Time install_time;
394 if (extension->location() != Manifest::COMPONENT) { 400 if (extension->location() != Manifest::COMPONENT) {
395 install_time = ExtensionPrefs::Get(profile_)-> 401 install_time = ExtensionPrefs::Get(profile_)->
396 GetInstallTime(extension->id()); 402 GetInstallTime(extension->id());
397 } 403 }
398 bool incognito_enabled = 404 bool incognito_enabled =
399 extension_util::IsIncognitoEnabled(extension->id(), extension_service()); 405 extension_util::IsIncognitoEnabled(extension->id(), extension_service());
400 BrowserThread::PostTask(BrowserThread::IO, 406
401 FROM_HERE, 407 bool notifications_disabled = false;
402 base::Bind(&InfoMap::AddExtension, 408 #if defined(ENABLE_NOTIFICATIONS)
403 info_map(), 409 message_center::NotifierId notifier_id(
404 make_scoped_refptr(extension), 410 message_center::NotifierId::APPLICATION,
405 install_time, 411 extension->id());
406 incognito_enabled)); 412
413 DesktopNotificationService* notification_service =
414 DesktopNotificationServiceFactory::GetForProfile(profile_);
415 notifications_disabled =
416 !notification_service->IsNotifierEnabled(notifier_id);
417 #endif
418
419 BrowserThread::PostTask(
420 BrowserThread::IO, FROM_HERE,
421 base::Bind(&InfoMap::AddExtension, info_map(),
422 make_scoped_refptr(extension), install_time,
423 incognito_enabled, notifications_disabled));
407 } 424 }
408 425
409 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 426 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
410 const std::string& extension_id, 427 const std::string& extension_id,
411 const UnloadedExtensionInfo::Reason reason) { 428 const UnloadedExtensionInfo::Reason reason) {
412 BrowserThread::PostTask( 429 BrowserThread::PostTask(
413 BrowserThread::IO, 430 BrowserThread::IO,
414 FROM_HERE, 431 FROM_HERE,
415 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); 432 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
416 } 433 }
417 434
418 } // namespace extensions 435 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_protocols_unittest.cc ('k') | chrome/browser/notifications/desktop_notification_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698