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

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

Issue 7795011: Fixing crash on sync when app becomes extension or vice versa. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 extension_sync_list.push_back(i->second); 1884 extension_sync_list.push_back(i->second);
1885 } 1885 }
1886 1886
1887 return extension_sync_list; 1887 return extension_sync_list;
1888 } 1888 }
1889 1889
1890 void ExtensionService::ProcessExtensionSyncData( 1890 void ExtensionService::ProcessExtensionSyncData(
1891 const ExtensionSyncData& extension_sync_data, 1891 const ExtensionSyncData& extension_sync_data,
1892 SyncBundle& bundle) { 1892 SyncBundle& bundle) {
1893 const std::string& id = extension_sync_data.id(); 1893 const std::string& id = extension_sync_data.id();
1894 const Extension* extension = GetInstalledExtension(id);
1895
1896 // TODO(bolms): we should really handle this better. The particularly bad
1897 // case is where an app becomes an extension or vice versa, and we end up with
1898 // a zombie extension that won't go away.
1899 if (extension && !bundle.filter(*extension))
1900 return;
1894 1901
1895 // Handle uninstalls first. 1902 // Handle uninstalls first.
1896 if (extension_sync_data.uninstalled()) { 1903 if (extension_sync_data.uninstalled()) {
1897 std::string error; 1904 std::string error;
1898 if (!UninstallExtensionHelper(this, id)) { 1905 if (!UninstallExtensionHelper(this, id)) {
1899 LOG(WARNING) << "Could not uninstall extension " << id 1906 LOG(WARNING) << "Could not uninstall extension " << id
1900 << " for sync"; 1907 << " for sync";
1901 } 1908 }
1902 return; 1909 return;
1903 } 1910 }
1904 1911
1905 // Set user settings. 1912 // Set user settings.
1906 if (extension_sync_data.enabled()) { 1913 if (extension_sync_data.enabled()) {
1907 EnableExtension(id); 1914 EnableExtension(id);
1908 } else { 1915 } else {
1909 DisableExtension(id); 1916 DisableExtension(id);
1910 } 1917 }
1911 SetIsIncognitoEnabled(id, extension_sync_data.incognito_enabled()); 1918 SetIsIncognitoEnabled(id, extension_sync_data.incognito_enabled());
1912 1919
1913 const Extension* extension = GetInstalledExtension(id);
1914 if (extension) { 1920 if (extension) {
1915 // If the extension is already installed, check if it's outdated. 1921 // If the extension is already installed, check if it's outdated.
1916 int result = extension->version()->CompareTo(extension_sync_data.version()); 1922 int result = extension->version()->CompareTo(extension_sync_data.version());
1917 if (result < 0) { 1923 if (result < 0) {
1918 // Extension is outdated. 1924 // Extension is outdated.
1919 bundle.pending_sync_data[extension_sync_data.id()] = extension_sync_data; 1925 bundle.pending_sync_data[extension_sync_data.id()] = extension_sync_data;
1920 CheckForUpdatesSoon(); 1926 CheckForUpdatesSoon();
1921 } 1927 }
1922 } else { 1928 } else {
1923 // TODO(akalin): Replace silent update with a list of enabled 1929 // TODO(akalin): Replace silent update with a list of enabled
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
2851 2857
2852 ExtensionService::NaClModuleInfoList::iterator 2858 ExtensionService::NaClModuleInfoList::iterator
2853 ExtensionService::FindNaClModule(const GURL& url) { 2859 ExtensionService::FindNaClModule(const GURL& url) {
2854 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2860 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2855 iter != nacl_module_list_.end(); ++iter) { 2861 iter != nacl_module_list_.end(); ++iter) {
2856 if (iter->url == url) 2862 if (iter->url == url)
2857 return iter; 2863 return iter;
2858 } 2864 }
2859 return nacl_module_list_.end(); 2865 return nacl_module_list_.end();
2860 } 2866 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698