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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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) 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 using content::BrowserThread; 158 using content::BrowserThread;
159 using content::BrowserURLHandler; 159 using content::BrowserURLHandler;
160 using content::ChildProcessSecurityPolicy; 160 using content::ChildProcessSecurityPolicy;
161 using content::FileDescriptorInfo; 161 using content::FileDescriptorInfo;
162 using content::QuotaPermissionContext; 162 using content::QuotaPermissionContext;
163 using content::RenderViewHost; 163 using content::RenderViewHost;
164 using content::SiteInstance; 164 using content::SiteInstance;
165 using content::WebContents; 165 using content::WebContents;
166 using extensions::APIPermission; 166 using extensions::APIPermission;
167 using extensions::Extension; 167 using extensions::Extension;
168 using extensions::Manifest;
168 using webkit_glue::WebPreferences; 169 using webkit_glue::WebPreferences;
169 170
170 namespace { 171 namespace {
171 172
172 const char* kPredefinedAllowedSocketOrigins[] = { 173 const char* kPredefinedAllowedSocketOrigins[] = {
173 "okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client 174 "okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client
174 "pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client) 175 "pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client)
175 "bglhmjfplikpjnfoegeomebmfnkjomhe", // see crbug.com/122126 176 "bglhmjfplikpjnfoegeomebmfnkjomhe", // see crbug.com/122126
176 "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop 177 "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop
177 "kgngmbheleoaphbjbaiobfdepmghbfah", // Pre-release Chrome Remote Desktop 178 "kgngmbheleoaphbjbaiobfdepmghbfah", // Pre-release Chrome Remote Desktop
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 789
789 const Extension* extension = extension_service->extensions()-> 790 const Extension* extension = extension_service->extensions()->
790 GetExtensionOrAppByURL(ExtensionURLInfo(effective_url)); 791 GetExtensionOrAppByURL(ExtensionURLInfo(effective_url));
791 if (!extension) 792 if (!extension)
792 return false; 793 return false;
793 794
794 // If the URL is part of a hosted app that does not have the background 795 // If the URL is part of a hosted app that does not have the background
795 // permission, or that does not allow JavaScript access to the background 796 // permission, or that does not allow JavaScript access to the background
796 // page, we want to give each instance its own process to improve 797 // page, we want to give each instance its own process to improve
797 // responsiveness. 798 // responsiveness.
798 if (extension->GetType() == Extension::TYPE_HOSTED_APP) { 799 if (extension->GetType() == Manifest::TYPE_HOSTED_APP) {
799 if (!extension->HasAPIPermission(APIPermission::kBackground) || 800 if (!extension->HasAPIPermission(APIPermission::kBackground) ||
800 !extension->allow_background_js_access()) { 801 !extension->allow_background_js_access()) {
801 return false; 802 return false;
802 } 803 }
803 } 804 }
804 805
805 // Hosted apps that have script access to their background page must use 806 // Hosted apps that have script access to their background page must use
806 // process per site, since all instances can make synchronous calls to the 807 // process per site, since all instances can make synchronous calls to the
807 // background window. Other extensions should use process per site as well. 808 // background window. Other extensions should use process per site as well.
808 return true; 809 return true;
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 } 1913 }
1913 1914
1914 // Need to check this now and not on construction because otherwise it won't 1915 // Need to check this now and not on construction because otherwise it won't
1915 // work with browser_tests. 1916 // work with browser_tests.
1916 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1917 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1917 std::string allowed_list = 1918 std::string allowed_list =
1918 command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI); 1919 command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI);
1919 if (allowed_list == "*") { 1920 if (allowed_list == "*") {
1920 // The wildcard allows socket API only for packaged and platform apps. 1921 // The wildcard allows socket API only for packaged and platform apps.
1921 return extension && 1922 return extension &&
1922 (extension->GetType() == Extension::TYPE_LEGACY_PACKAGED_APP || 1923 (extension->GetType() == Manifest::TYPE_LEGACY_PACKAGED_APP ||
1923 extension->GetType() == Extension::TYPE_PLATFORM_APP); 1924 extension->GetType() == Manifest::TYPE_PLATFORM_APP);
1924 } else if (!allowed_list.empty()) { 1925 } else if (!allowed_list.empty()) {
1925 StringTokenizer t(allowed_list, ","); 1926 StringTokenizer t(allowed_list, ",");
1926 while (t.GetNext()) { 1927 while (t.GetNext()) {
1927 if (t.token() == host) 1928 if (t.token() == host)
1928 return true; 1929 return true;
1929 } 1930 }
1930 } 1931 }
1931 1932
1932 if (!extension) 1933 if (!extension)
1933 return false; 1934 return false;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 io_thread_application_locale_ = locale; 2046 io_thread_application_locale_ = locale;
2046 } 2047 }
2047 2048
2048 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( 2049 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread(
2049 const std::string& locale) { 2050 const std::string& locale) {
2050 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2051 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
2051 io_thread_application_locale_ = locale; 2052 io_thread_application_locale_ = locale;
2052 } 2053 }
2053 2054
2054 } // namespace chrome 2055 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698