diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 22:47:05 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 22:47:05 +0000 |
commit | 745adaf46dbebab2e661a80171c2e3f00f781c97 (patch) | |
tree | 3213a89c7646c5cb291e04da452d2fda7498a50d /chrome | |
parent | 8702a2a5130a4de75f42a472acd5ac3b0bb236a4 (diff) | |
download | chromium_src-745adaf46dbebab2e661a80171c2e3f00f781c97.zip chromium_src-745adaf46dbebab2e661a80171c2e3f00f781c97.tar.gz chromium_src-745adaf46dbebab2e661a80171c2e3f00f781c97.tar.bz2 |
No longer display EULA when internal Flash enabled (revert r42783 and most of r42674).
BUG=none
TEST=Run (branded, official) Google Chrome build with --enable-internal-flash; EULA "dialog" tab should no longer be shown, and our Flash should be enabled (check about:plugins). Without --enable-internal-flash, it should still not appear in about:plugins.
Review URL: http://codereview.chromium.org/1527023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser_init.cc | 16 | ||||
-rw-r--r-- | chrome/browser/browser_resources.grd | 1 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui_factory.cc | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/eula_ui.cc | 180 | ||||
-rw-r--r-- | chrome/browser/dom_ui/eula_ui.h | 21 | ||||
-rw-r--r-- | chrome/browser/plugin_service.cc | 10 | ||||
-rw-r--r-- | chrome/browser/resources/eula.html | 92 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 | ||||
-rw-r--r-- | chrome/common/url_constants.cc | 5 | ||||
-rw-r--r-- | chrome/common/url_constants.h | 5 |
12 files changed, 0 insertions, 339 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index a18558f..e4c3438 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -488,22 +488,6 @@ bool BrowserInit::LaunchWithProfile::Launch(Profile* profile, std::vector<GURL> urls_to_open = GetURLsFromCommandLine(profile_); RecordLaunchModeHistogram(urls_to_open.empty()? LM_TO_BE_DECIDED : LM_WITH_URLS); - // TODO(viettrungluu): Temporary: Display a EULA before allowing the user to - // actually enable Flash, unless they've already accepted it. Process this - // in the same way as command-line URLs. - FilePath flash_path; - if (command_line_.HasSwitch(switches::kEnableInternalFlash) && - PathService::Get(chrome::FILE_FLASH_PLUGIN, &flash_path)) { - PrefService* prefs = profile->GetPrefs(); - // Check whether the EULA has previously been accepted, defaulting to - // "no". If it hasn't, display a page which links to the EULA, etc. (This - // pref is registered by the plugin service.) - if (!prefs->GetBoolean(prefs::kPluginsFlashAuthorized)) { - urls_to_open.push_back( - GURL(chrome::kChromeUIEulaAuthorizeFlashURL)); - } - } - ProcessLaunchURLs(process_startup, urls_to_open); // If this is an app launch, but we didn't open an app window, it may diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index fe9f9e9..48d09f96 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd @@ -48,7 +48,6 @@ without changes to the corresponding grd file. fbt1 --> <include name="IDR_DOWNLOADS_HTML" file="resources\downloads.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_LOCAL_STRINGS_JS" file="resources\local_strings.js" type="BINDATA" /> <include name="IDR_DOM_UI_CSS" file="resources\dom_ui.css" flattenhtml="true" type="BINDATA" /> - <include name="IDR_EULA_HTML" file="resources\eula.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_EXTENSIONS_UI_HTML" file="resources\extensions_ui.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_EXTENSION_DEFAULT_ICON" file="resources\extension_default_icon.png" type="BINDATA" /> <include name="IDR_EXTENSIONS_INFOBAR_CSS" file="resources\extensions_infobar.css" flattenhtml="true" type="BINDATA" /> diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc index a108213..658c2aa 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.cc +++ b/chrome/browser/dom_ui/dom_ui_factory.cc @@ -9,7 +9,6 @@ #include "chrome/browser/dom_ui/bookmarks_ui.h" #include "chrome/browser/dom_ui/downloads_ui.h" #include "chrome/browser/dom_ui/devtools_ui.h" -#include "chrome/browser/dom_ui/eula_ui.h" #include "chrome/browser/dom_ui/history_ui.h" #include "chrome/browser/dom_ui/filebrowse_ui.h" #include "chrome/browser/dom_ui/html_dialog_ui.h" @@ -98,8 +97,6 @@ static DOMUIFactoryFunction GetDOMUIFactoryFunction(const GURL& url) { return &NewDOMUI<DevToolsUI>; if (url.host() == chrome::kChromeUIDownloadsHost) return &NewDOMUI<DownloadsUI>; - if (url.host() == chrome::kChromeUIEulaHost) - return &NewDOMUI<EulaUI>; if (url.host() == chrome::kChromeUIExtensionsHost) return &NewDOMUI<ExtensionsUI>; if (url.host() == chrome::kChromeUIHistoryHost) diff --git a/chrome/browser/dom_ui/eula_ui.cc b/chrome/browser/dom_ui/eula_ui.cc deleted file mode 100644 index 5dda847..0000000 --- a/chrome/browser/dom_ui/eula_ui.cc +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/dom_ui/eula_ui.h" - -#include "app/l10n_util.h" -#include "app/resource_bundle.h" -#include "base/command_line.h" -#include "base/path_service.h" -#include "base/singleton.h" -#include "base/values.h" -#include "chrome/browser/browser.h" -#include "chrome/browser/chrome_thread.h" -#include "chrome/browser/dom_ui/chrome_url_data_manager.h" -#include "chrome/browser/pref_service.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/common/jstemplate_builder.h" -#include "chrome/common/pref_names.h" -#include "chrome/common/url_constants.h" -#include "grit/browser_resources.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" -#include "webkit/glue/plugins/plugin_list.h" - -namespace { - -/////////////////////////////////////////////////////////////////////////////// -// -// EulaHTMLSource -// -/////////////////////////////////////////////////////////////////////////////// - -class EulaUIHTMLSource : public ChromeURLDataManager::DataSource { - public: - EulaUIHTMLSource() - : DataSource(chrome::kChromeUIEulaHost, MessageLoop::current()) {} - - // Called when the network layer has requested a resource underneath - // the path we registered. - virtual void StartDataRequest(const std::string& path, - bool is_off_the_record, - int request_id); - virtual std::string GetMimeType(const std::string&) const { - return "text/html"; - } - - private: - ~EulaUIHTMLSource() {} - - DISALLOW_COPY_AND_ASSIGN(EulaUIHTMLSource); -}; - -void EulaUIHTMLSource::StartDataRequest(const std::string& path, - bool is_off_the_record, - int request_id) { - scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); - - if (path == chrome::kChromeUIEulaAuthorizeFlashPath) { - // Strings used in the JsTemplate file. - // Since this is only temporary, don't provide localized strings. - // (Yes, it'll be messed up for RTL, but only as messed up as if we had - // strings in the .grd but no translations.) - DictionaryValue strings; - strings.SetString(L"title", L"Adobe Flash Player License Agreement"); - strings.SetString(L"acceptButton", L"Accept and Enable"); - strings.SetString(L"declineButton", L"Not Right Now"); - strings.SetString(L"eulaTitle", L"Adobe Flash Player for Google Chrome"); - strings.SetString(L"eulaDesc", - L"By enabling the integrated Adobe Flash Player for Google Chrome, " - L"you accept the <a href=\"http://www.adobe.com/products/eulas/" - L"players/flash/\" target=\"_blank\">Software License Agreement</a> " - L"for Adobe Flash Player."); - - SetFontAndTextDirection(&strings); - - static const base::StringPiece eula_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_EULA_HTML)); - const std::string full_html = jstemplate_builder::GetI18nTemplateHtml( - eula_html, &strings); - - html_bytes->data.resize(full_html.size()); - std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); - } - - SendResponse(request_id, html_bytes); -} - -//////////////////////////////////////////////////////////////////////////////// -// -// EulaDOMHandler -// -//////////////////////////////////////////////////////////////////////////////// - -// The handler for Javascript messages. -class EulaDOMHandler : public DOMMessageHandler { - public: - EulaDOMHandler() {} - virtual ~EulaDOMHandler() {} - - // DOMMessageHandler implementation. - virtual void RegisterMessages(); - - // Callbacks for the "acceptEula" and "declineEula" messages. - void HandleAcceptEulaMessage(const Value* value); - void HandleDeclineEulaMessage(const Value* value); - - private: - void NavigateToNewTabPage(); - - DISALLOW_COPY_AND_ASSIGN(EulaDOMHandler); -}; - -void EulaDOMHandler::RegisterMessages() { - dom_ui_->RegisterMessageCallback("acceptEula", - NewCallback(this, &EulaDOMHandler::HandleAcceptEulaMessage)); - dom_ui_->RegisterMessageCallback("declineEula", - NewCallback(this, &EulaDOMHandler::HandleDeclineEulaMessage)); -} - -void EulaDOMHandler::HandleAcceptEulaMessage(const Value* value) { - const CommandLine* command_line = CommandLine::ForCurrentProcess(); - FilePath flash_path; - if (command_line->HasSwitch(switches::kEnableInternalFlash) && - PathService::Get(chrome::FILE_FLASH_PLUGIN, &flash_path)) { - dom_ui_->GetProfile()->GetPrefs()->SetBoolean( - prefs::kPluginsFlashAuthorized, true); - NPAPI::PluginList::Singleton()->EnablePlugin(FilePath(flash_path)); - } else { - LOG(WARNING) << "Internal Flash Player not enabled or not available."; - } - - NavigateToNewTabPage(); -} - -void EulaDOMHandler::HandleDeclineEulaMessage(const Value* value) { - // Be generous in recording declines. - dom_ui_->GetProfile()->GetPrefs()->SetBoolean( - prefs::kPluginsFlashAuthorized, false); - FilePath flash_path; - if (PathService::Get(chrome::FILE_FLASH_PLUGIN, &flash_path)) - NPAPI::PluginList::Singleton()->DisablePlugin(FilePath(flash_path)); - - NavigateToNewTabPage(); -} - -void EulaDOMHandler::NavigateToNewTabPage() { - TabContents* tab_contents = dom_ui_->tab_contents(); - tab_contents->OpenURL(GURL(chrome::kChromeUINewTabURL), GURL(), - CURRENT_TAB, PageTransition::GENERATED); - if (Browser* browser = - Browser::GetBrowserForController(&tab_contents->controller(), NULL)) { - browser->FocusLocationBar(); - } -} - -} // namespace - -/////////////////////////////////////////////////////////////////////////////// -// -// EulaUI -// -/////////////////////////////////////////////////////////////////////////////// - -EulaUI::EulaUI(TabContents* contents) : DOMUI(contents) { - AddMessageHandler((new EulaDOMHandler())->Attach(this)); - - EulaUIHTMLSource* html_source = new EulaUIHTMLSource(); - - // Set up the chrome://eula/ source. - ChromeThread::PostTask( - ChromeThread::IO, FROM_HERE, - NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), - &ChromeURLDataManager::AddDataSource, - make_scoped_refptr(html_source))); -} diff --git a/chrome/browser/dom_ui/eula_ui.h b/chrome/browser/dom_ui/eula_ui.h deleted file mode 100644 index f473e70..0000000 --- a/chrome/browser/dom_ui/eula_ui.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_DOM_UI_EULA_UI_H_ -#define CHROME_BROWSER_DOM_UI_EULA_UI_H_ - -// Page to display the EULA for the internal Flash Player. -// TODO(viettrungluu): Very temporary. Remove. - -#include "chrome/browser/dom_ui/dom_ui.h" - -class EulaUI : public DOMUI { - public: - explicit EulaUI(TabContents* contents); - - private: - DISALLOW_COPY_AND_ASSIGN(EulaUI); -}; - -#endif // CHROME_BROWSER_DOM_UI_EULA_UI_H_ diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index f16108d..12739c8 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -76,16 +76,6 @@ void PluginService::InitGlobalInstance(Profile* profile) { } } - // TODO(viettrungluu): Temporary: If the user hasn't accepted the EULA, - // disable internal Flash (if it's available). - PrefService* prefs = profile->GetPrefs(); - FilePath flash_path; - if (PathService::Get(chrome::FILE_FLASH_PLUGIN, &flash_path)) { - prefs->RegisterBooleanPref(prefs::kPluginsFlashAuthorized, false); - if (!prefs->GetBoolean(prefs::kPluginsFlashAuthorized)) - NPAPI::PluginList::Singleton()->DisablePlugin(FilePath(flash_path)); - } - // Have Chrome plugins write their data to the profile directory. GetInstance()->SetChromePluginDataDir(profile->GetPath()); } diff --git a/chrome/browser/resources/eula.html b/chrome/browser/resources/eula.html deleted file mode 100644 index ffe77a7..0000000 --- a/chrome/browser/resources/eula.html +++ /dev/null @@ -1,92 +0,0 @@ -<!DOCTYPE html> -<html i18n-values="dir:textdirection"> -<head> -<title i18n-content="title"></title> -<style> -#dialogBackground, #dialogBackground div { - display: -webkit-box; - -webkit-box-align: center; -} - -#dialog button { - font-size: 12px; - height: 25px; - width: 150px; -} - -#dialogBackground { - display: -webkit-box; - background-color: white; - height: 100%; - left: 0; - position: fixed; - top: 0; - width: 100%; - z-index: 1; - -webkit-box-orient: vertical; - -webkit-user-select: none; -} - -html[dir='rtl'] #dialogBackground { - right: 0; - left: auto; -} - -#dialogHBackground { - height: 100%; - -webkit-box-orient: horizontal; -} - -#dialog { - padding: 14px 18px; - border: 2px solid hsl(213, 55%, 75%); - background-color: hsl(213, 63%, 93%); - -webkit-box-shadow: 3px 3px 6px hsla(0, 0%, 0%, .3); - border-radius: 6px 6px; - max-width: 450px; - -webkit-box-orient: vertical; -} - -#eulaTitle { - padding-bottom: 8px; - font-weight: bold; - font-size: 105%; -} - -#eulaButtonRow { - padding-top: 15px; - padding-bottom: 5px; -} - -#eulaButtonRow button { - margin-left: 15px; - margin-right: 15px; -} -</style> -<script> -function acceptEula() { - chrome.send('acceptEula', []); -} - -function declineEula() { - chrome.send('declineEula', []); -} -</script> -</head> -<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> -<div id="dialogBackground"> -<div id="dialogHBackground"> -<div id="dialog"> - <div id="eulaTitle" i18n-content="eulaTitle">EULA_TITLE</div> - <div id="eulaDesc" i18n-values=".innerHTML:eulaDesc">EULA_DESCRIPTION</div> - <div id="eulaButtonRow"> - <button i18n-content="acceptButton" onclick="acceptEula()"> - ACCEPT_EULA</button> - <button i18n-content="declineButton" onclick="declineEula()"> - DECLINE_EULA</button> - </div> -</div> -</div> -</div> -</body> -</html> diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index c8ff9e8..7545f735 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -880,8 +880,6 @@ 'browser/dom_ui/downloads_dom_handler.h', 'browser/dom_ui/downloads_ui.cc', 'browser/dom_ui/downloads_ui.h', - 'browser/dom_ui/eula_ui.cc', - 'browser/dom_ui/eula_ui.h', 'browser/dom_ui/fileicon_source.cc', 'browser/dom_ui/fileicon_source.h', 'browser/dom_ui/filebrowse_ui.cc', diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 5f8cd2d..cbe06b4 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -289,9 +289,6 @@ const wchar_t kExtensionsUIDeveloperMode[] = L"extensions.ui.developer_mode"; // actions toolbar. const wchar_t kExtensionToolbarSize[] = L"extensions.toolbarsize"; -// Boolean pref which determines whether the Flash EULA has been accepted. -const wchar_t kPluginsFlashAuthorized[] = L"plugins.flash_authorized"; - // List pref containing information (dictionaries) on plugins. const wchar_t kPluginsPluginsList[] = L"plugins.plugins_list"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 23cd977..83424fb 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -115,7 +115,6 @@ extern const wchar_t kCurrentThemeTints[]; extern const wchar_t kCurrentThemeDisplayProperties[]; extern const wchar_t kExtensionsUIDeveloperMode[]; extern const wchar_t kExtensionToolbarSize[]; -extern const wchar_t kPluginsFlashAuthorized[]; extern const wchar_t kPluginsPluginsList[]; extern const wchar_t kCheckDefaultBrowser[]; #if defined(OS_MACOSX) diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 1511243..33b62ca 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -83,11 +83,6 @@ const char kChromeUINewTabHost[] = "newtab"; const char kChromeUIThumbnailPath[] = "thumb"; const char kChromeUIThemePath[] = "theme"; -// TODO(viettrungluu): Temporary, while we need to display a EULA for Flash. -const char kChromeUIEulaAuthorizeFlashURL[] = "chrome://eula/FlashPlayer"; -const char kChromeUIEulaAuthorizeFlashPath[] = "FlashPlayer"; -const char kChromeUIEulaHost[] = "eula"; - const char kSyncResourcesHost[] = "syncresources"; const char kSyncGaiaLoginPath[] = "gaialogin"; const char kSyncMergeAndSyncPath[] = "mergeandsync"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 8bc86af..f6a3086 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -80,11 +80,6 @@ extern const char kChromeUINewTabHost[]; extern const char kChromeUIThumbnailPath[]; extern const char kChromeUIThemePath[]; -// TODO(viettrungluu): Temporary, while we need to display a EULA for Flash. -extern const char kChromeUIEulaAuthorizeFlashURL[]; -extern const char kChromeUIEulaAuthorizeFlashPath[]; -extern const char kChromeUIEulaHost[]; - // Sync related URL components. extern const char kSyncResourcesHost[]; extern const char kSyncGaiaLoginPath[]; |