~oem-solutions-group/firefox/firefox-3.0.dennis

« back to all changes in this revision

Viewing changes to debian/patches/bz515232_att399338_distro_locale_searchplugins.patch

  • Committer: Nicolas Valcarcel Scerpella
  • Date: 2010-06-30 19:15:40 UTC
  • Revision ID: nvalcarcel@canonical.com-20100630191540-siqaxe8ab11kn4dx
revertedĀ forĀ re-merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
---
2
 
 browser/components/dirprovider/Makefile.in                    |    1 
3
 
 browser/components/dirprovider/nsBrowserDirectoryProvider.cpp |   54 +++++-----
4
 
 2 files changed, 32 insertions(+), 23 deletions(-)
5
 
 
6
 
Index: mozilla/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp
7
 
===================================================================
8
 
--- mozilla.orig/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp
9
 
+++ mozilla/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp
10
 
@@ -30,16 +30,17 @@
11
 
  * use your version of this file under the terms of the MPL, indicate your
12
 
  * decision by deleting the provisions above and replace them with the notice
13
 
  * and other provisions required by the GPL or the LGPL. If you do not delete
14
 
  * the provisions above, a recipient may use your version of this file under
15
 
  * the terms of any one of the MPL, the GPL or the LGPL.
16
 
  *
17
 
  * ***** END LICENSE BLOCK ***** */
18
 
 
19
 
+#include "nsIChromeRegistry.h"
20
 
 #include "nsIDirectoryService.h"
21
 
 
22
 
 #include "nsIFile.h"
23
 
 #include "nsISimpleEnumerator.h"
24
 
 #include "nsIPrefService.h"
25
 
 #include "nsIPrefBranch.h"
26
 
 
27
 
 #include "nsArrayEnumerator.h"
28
 
@@ -234,47 +235,51 @@ AppendDistroSearchDirs(nsIProperties* aD
29
 
   if (NS_FAILED(rv) || !exists)
30
 
     return;
31
 
 
32
 
   nsCOMPtr<nsIFile> commonPlugins;
33
 
   rv = searchPlugins->Clone(getter_AddRefs(commonPlugins));
34
 
   if (NS_SUCCEEDED(rv)) {
35
 
     commonPlugins->AppendNative(NS_LITERAL_CSTRING("common"));
36
 
     rv = commonPlugins->Exists(&exists);
37
 
-    if (NS_SUCCEEDED(rv) && exists)
38
 
-        array.AppendObject(commonPlugins);
39
 
+    if (NS_FAILED(rv) || !exists)
40
 
+        commonPlugins = nsnull;
41
 
   }
42
 
+  if (NS_FAILED(rv))
43
 
+    return;
44
 
 
45
 
-  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
46
 
-  if (prefs) {
47
 
-
48
 
-    nsCOMPtr<nsIFile> localePlugins;
49
 
-    rv = searchPlugins->Clone(getter_AddRefs(localePlugins));
50
 
-    if (NS_FAILED(rv))
51
 
-      return;
52
 
+  nsCAutoString locale;
53
 
+  nsCOMPtr<nsIFile> localePlugins;
54
 
+  rv = searchPlugins->Clone(getter_AddRefs(localePlugins));
55
 
+  if (NS_FAILED(rv))
56
 
+    return;
57
 
 
58
 
-    localePlugins->AppendNative(NS_LITERAL_CSTRING("locale"));
59
 
+  nsCOMPtr<nsIXULChromeRegistry> chromeReg =
60
 
+    do_GetService(NS_CHROMEREGISTRY_CONTRACTID);
61
 
+  if (!chromeReg)
62
 
+    return;
63
 
 
64
 
-    nsCString locale;
65
 
-    rv = prefs->GetCharPref("general.useragent.locale", getter_Copies(locale));
66
 
+  chromeReg->GetSelectedLocale(NS_LITERAL_CSTRING("global"), locale);
67
 
+  if (NS_SUCCEEDED(rv)) {
68
 
+    nsCOMPtr<nsIFile> curLocalePlugins;
69
 
+    rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins));
70
 
     if (NS_SUCCEEDED(rv)) {
71
 
-
72
 
-      nsCOMPtr<nsIFile> curLocalePlugins;
73
 
-      rv = localePlugins->Clone(getter_AddRefs(curLocalePlugins));
74
 
-      if (NS_SUCCEEDED(rv)) {
75
 
-
76
 
-        curLocalePlugins->AppendNative(locale);
77
 
-        rv = curLocalePlugins->Exists(&exists);
78
 
-        if (NS_SUCCEEDED(rv) && exists) {
79
 
-          array.AppendObject(curLocalePlugins);
80
 
-          return; // all done
81
 
-        }
82
 
+      curLocalePlugins->AppendNative(locale);
83
 
+      rv = curLocalePlugins->Exists(&exists);
84
 
+      if (NS_SUCCEEDED(rv) && exists) {
85
 
+        array.AppendObject(curLocalePlugins);
86
 
+        if (commonPlugins)
87
 
+          array.AppendObject(commonPlugins);
88
 
+        return; // all done
89
 
       }
90
 
     }
91
 
+  }
92
 
 
93
 
+  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
94
 
+  if (prefs) {
95
 
     // we didn't append the locale dir - try the default one
96
 
     nsCString defLocale;
97
 
     rv = prefs->GetCharPref("distribution.searchplugins.defaultLocale",
98
 
                             getter_Copies(defLocale));
99
 
     if (NS_SUCCEEDED(rv)) {
100
 
 
101
 
       nsCOMPtr<nsIFile> defLocalePlugins;
102
 
       rv = localePlugins->Clone(getter_AddRefs(defLocalePlugins));
103
 
@@ -282,16 +287,19 @@ AppendDistroSearchDirs(nsIProperties* aD
104
 
 
105
 
         defLocalePlugins->AppendNative(defLocale);
106
 
         rv = defLocalePlugins->Exists(&exists);
107
 
         if (NS_SUCCEEDED(rv) && exists)
108
 
           array.AppendObject(defLocalePlugins);
109
 
       }
110
 
     }
111
 
   }
112
 
+
113
 
+  if (commonPlugins)
114
 
+    array.AppendObject(commonPlugins);
115
 
 }
116
 
 
117
 
 NS_IMETHODIMP
118
 
 nsBrowserDirectoryProvider::GetFiles(const char *aKey,
119
 
                                      nsISimpleEnumerator* *aResult)
120
 
 {
121
 
   nsresult rv;
122
 
 
123
 
Index: mozilla/browser/components/dirprovider/Makefile.in
124
 
===================================================================
125
 
--- mozilla.orig/browser/components/dirprovider/Makefile.in
126
 
+++ mozilla/browser/components/dirprovider/Makefile.in
127
 
@@ -53,16 +53,17 @@ FORCE_SHARED_LIB     = 1
128
 
 
129
 
 # Because we are an application component, link against the CRT statically
130
 
 # (on Windows, but only if we're not building our own CRT for jemalloc)
131
 
 ifndef MOZ_MEMORY
132
 
 USE_STATIC_LIBS      = 1
133
 
 endif
134
 
 
135
 
 REQUIRES = \
136
 
+       content \
137
 
        xpcom \
138
 
        string \
139
 
        pref \
140
 
        xulapp \
141
 
        $(NULL)
142
 
 
143
 
 CPPSRCS = nsBrowserDirectoryProvider.cpp
144