Commit 06bfeb15 authored by thestig@chromium.org's avatar thestig@chromium.org

Cleanup: Make namespace shell_integration_linux follow the style guide.

Review URL: https://codereview.chromium.org/300463002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272966 0039d316-1c4b-4281-b951-d872f2087c98
parent 313fcf63
...@@ -323,17 +323,13 @@ const char kAppListDesktopName[] = "chrome-app-list"; ...@@ -323,17 +323,13 @@ const char kAppListDesktopName[] = "chrome-app-list";
const char kAppListDesktopName[] = "chromium-app-list"; const char kAppListDesktopName[] = "chromium-app-list";
#endif #endif
} // namespace
namespace {
// Utility function to get the path to the version of a script shipped with // Utility function to get the path to the version of a script shipped with
// Chrome. |script| gives the name of the script. |chrome_version| returns the // Chrome. |script| gives the name of the script. |chrome_version| returns the
// path to the Chrome version of the script, and the return value of the // path to the Chrome version of the script, and the return value of the
// function is true if the function is successful and the Chrome version is // function is true if the function is successful and the Chrome version is
// not the script found on the PATH. // not the script found on the PATH.
bool GetChromeVersionOfScript(const std::string& script, bool GetChromeVersionOfScript(const std::string& script,
std::string* chrome_version) { std::string* chrome_version) {
// Get the path to the Chrome version. // Get the path to the Chrome version.
base::FilePath chrome_dir; base::FilePath chrome_dir;
if (!PathService::Get(base::DIR_EXE, &chrome_dir)) if (!PathService::Get(base::DIR_EXE, &chrome_dir))
...@@ -386,7 +382,7 @@ bool SetDefaultWebClient(const std::string& protocol) { ...@@ -386,7 +382,7 @@ bool SetDefaultWebClient(const std::string& protocol) {
argv.push_back(kXdgSettingsDefaultSchemeHandler); argv.push_back(kXdgSettingsDefaultSchemeHandler);
argv.push_back(protocol); argv.push_back(protocol);
} }
argv.push_back(ShellIntegrationLinux::GetDesktopName(env.get())); argv.push_back(shell_integration_linux::GetDesktopName(env.get()));
int exit_code; int exit_code;
bool ran_ok = LaunchXdgUtility(argv, &exit_code); bool ran_ok = LaunchXdgUtility(argv, &exit_code);
...@@ -421,7 +417,7 @@ ShellIntegration::DefaultWebClientState GetIsDefaultWebClient( ...@@ -421,7 +417,7 @@ ShellIntegration::DefaultWebClientState GetIsDefaultWebClient(
argv.push_back(kXdgSettingsDefaultSchemeHandler); argv.push_back(kXdgSettingsDefaultSchemeHandler);
argv.push_back(protocol); argv.push_back(protocol);
} }
argv.push_back(ShellIntegrationLinux::GetDesktopName(env.get())); argv.push_back(shell_integration_linux::GetDesktopName(env.get()));
std::string reply; std::string reply;
int success_code; int success_code;
...@@ -499,11 +495,11 @@ base::FilePath GetChromeExePath() { ...@@ -499,11 +495,11 @@ base::FilePath GetChromeExePath() {
return chrome_exe_path; return chrome_exe_path;
} }
} // namespace } // namespace
// static // static
ShellIntegration::DefaultWebClientSetPermission ShellIntegration::DefaultWebClientSetPermission
ShellIntegration::CanSetAsDefaultBrowser() { ShellIntegration::CanSetAsDefaultBrowser() {
return SET_DEFAULT_UNATTENDED; return SET_DEFAULT_UNATTENDED;
} }
...@@ -513,12 +509,14 @@ bool ShellIntegration::SetAsDefaultBrowser() { ...@@ -513,12 +509,14 @@ bool ShellIntegration::SetAsDefaultBrowser() {
} }
// static // static
bool ShellIntegration::SetAsDefaultProtocolClient(const std::string& protocol) { bool ShellIntegration::SetAsDefaultProtocolClient(
const std::string& protocol) {
return SetDefaultWebClient(protocol); return SetDefaultWebClient(protocol);
} }
// static // static
ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() { ShellIntegration::DefaultWebClientState
ShellIntegration::GetDefaultBrowser() {
return GetIsDefaultWebClient(std::string()); return GetIsDefaultWebClient(std::string());
} }
...@@ -547,7 +545,7 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() { ...@@ -547,7 +545,7 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() {
return browser.find("irefox") != std::string::npos; return browser.find("irefox") != std::string::npos;
} }
namespace ShellIntegrationLinux { namespace shell_integration_linux {
bool GetDataWriteLocation(base::Environment* env, base::FilePath* search_path) { bool GetDataWriteLocation(base::Environment* env, base::FilePath* search_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
...@@ -856,7 +854,7 @@ std::string GetDesktopFileContentsForCommand( ...@@ -856,7 +854,7 @@ std::string GetDesktopFileContentsForCommand(
return output_buffer; return output_buffer;
#else #else
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return std::string(""); return std::string();
#endif #endif
} }
...@@ -896,7 +894,7 @@ std::string GetDirectoryFileContents(const base::string16& title, ...@@ -896,7 +894,7 @@ std::string GetDirectoryFileContents(const base::string16& title,
return output_buffer; return output_buffer;
#else #else
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return std::string(""); return std::string();
#endif #endif
} }
...@@ -940,7 +938,7 @@ bool CreateDesktopShortcut( ...@@ -940,7 +938,7 @@ bool CreateDesktopShortcut(
} }
if (creation_locations.on_desktop) { if (creation_locations.on_desktop) {
std::string contents = ShellIntegrationLinux::GetDesktopFileContents( std::string contents = GetDesktopFileContents(
chrome_exe_path, chrome_exe_path,
app_name, app_name,
shortcut_info.url, shortcut_info.url,
...@@ -964,7 +962,7 @@ bool CreateDesktopShortcut( ...@@ -964,7 +962,7 @@ bool CreateDesktopShortcut(
break; break;
case web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS: case web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS:
directory_filename = base::FilePath(kDirectoryFilename); directory_filename = base::FilePath(kDirectoryFilename);
directory_contents = ShellIntegrationLinux::GetDirectoryFileContents( directory_contents = GetDirectoryFileContents(
ShellIntegration::GetAppShortcutsSubdirName(), ""); ShellIntegration::GetAppShortcutsSubdirName(), "");
break; break;
default: default:
...@@ -973,7 +971,7 @@ bool CreateDesktopShortcut( ...@@ -973,7 +971,7 @@ bool CreateDesktopShortcut(
} }
// Set NoDisplay=true if hidden but not in the applications menu. This will // Set NoDisplay=true if hidden but not in the applications menu. This will
// hide the application from user-facing menus. // hide the application from user-facing menus.
std::string contents = ShellIntegrationLinux::GetDesktopFileContents( std::string contents = GetDesktopFileContents(
chrome_exe_path, chrome_exe_path,
app_name, app_name,
shortcut_info.url, shortcut_info.url,
...@@ -1081,4 +1079,4 @@ void DeleteAllDesktopShortcuts(const base::FilePath& profile_path) { ...@@ -1081,4 +1079,4 @@ void DeleteAllDesktopShortcuts(const base::FilePath& profile_path) {
} }
} }
} // namespace ShellIntegrationLinux } // namespace shell_integration_linux
...@@ -17,7 +17,7 @@ class CommandLine; ...@@ -17,7 +17,7 @@ class CommandLine;
class Environment; class Environment;
} }
namespace ShellIntegrationLinux { namespace shell_integration_linux {
// Get the path to write user-specific application data files to, as specified // Get the path to write user-specific application data files to, as specified
// in the XDG Base Directory Specification: // in the XDG Base Directory Specification:
...@@ -136,6 +136,6 @@ void DeleteDesktopShortcuts(const base::FilePath& profile_path, ...@@ -136,6 +136,6 @@ void DeleteDesktopShortcuts(const base::FilePath& profile_path,
// for the profile in |profile_path|. // for the profile in |profile_path|.
void DeleteAllDesktopShortcuts(const base::FilePath& profile_path); void DeleteAllDesktopShortcuts(const base::FilePath& profile_path);
} // namespace ShellIntegrationLinux } // namespace shell_integration_linux
#endif // CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_ #endif // CHROME_BROWSER_SHELL_INTEGRATION_LINUX_H_
...@@ -28,7 +28,7 @@ void CreateShortcuts() { ...@@ -28,7 +28,7 @@ void CreateShortcuts() {
std::string app_list_title = std::string app_list_title =
l10n_util::GetStringUTF8(IDS_APP_LIST_SHORTCUT_NAME); l10n_util::GetStringUTF8(IDS_APP_LIST_SHORTCUT_NAME);
if (!ShellIntegrationLinux::CreateAppListDesktopShortcut( if (!shell_integration_linux::CreateAppListDesktopShortcut(
app_list::kAppListWMClass, app_list::kAppListWMClass,
app_list_title)) { app_list_title)) {
LOG(WARNING) << "Unable to create App Launcher shortcut."; LOG(WARNING) << "Unable to create App Launcher shortcut.";
......
...@@ -136,7 +136,7 @@ class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate, ...@@ -136,7 +136,7 @@ class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate,
window_state_->AddObserver(this); window_state_->AddObserver(this);
window_state_->window()->AddObserver(this); window_state_->window()->AddObserver(this);
} }
virtual ~NativeAppWindowStateDelegate(){ virtual ~NativeAppWindowStateDelegate() {
if (window_state_) { if (window_state_) {
window_state_->RemoveObserver(this); window_state_->RemoveObserver(this);
window_state_->window()->RemoveObserver(this); window_state_->window()->RemoveObserver(this);
...@@ -220,7 +220,7 @@ void ChromeNativeAppWindowViews::InitializeDefaultWindow( ...@@ -220,7 +220,7 @@ void ChromeNativeAppWindowViews::InitializeDefaultWindow(
// Set up a custom WM_CLASS for app windows. This allows task switchers in // Set up a custom WM_CLASS for app windows. This allows task switchers in
// X11 environments to distinguish them from main browser windows. // X11 environments to distinguish them from main browser windows.
init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name); init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name);
init_params.wm_class_class = ShellIntegrationLinux::GetProgramClassName(); init_params.wm_class_class = shell_integration_linux::GetProgramClassName();
const char kX11WindowRoleApp[] = "app"; const char kX11WindowRoleApp[] = "app";
init_params.wm_role_name = std::string(kX11WindowRoleApp); init_params.wm_role_name = std::string(kX11WindowRoleApp);
#endif #endif
......
...@@ -108,8 +108,8 @@ void BrowserFrame::InitBrowserFrame() { ...@@ -108,8 +108,8 @@ void BrowserFrame::InitBrowserFrame() {
chrome::HOST_DESKTOP_TYPE_ASH || chrome::ShouldOpenAshOnStartup()) { chrome::HOST_DESKTOP_TYPE_ASH || chrome::ShouldOpenAshOnStartup()) {
params.context = ash::Shell::GetPrimaryRootWindow(); params.context = ash::Shell::GetPrimaryRootWindow();
#if defined(OS_WIN) #if defined(OS_WIN)
// If this window is under ASH on Windows, we need it to be translucent. // If this window is under ASH on Windows, we need it to be translucent.
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
#endif #endif
} }
#endif #endif
...@@ -120,7 +120,7 @@ void BrowserFrame::InitBrowserFrame() { ...@@ -120,7 +120,7 @@ void BrowserFrame::InitBrowserFrame() {
// windows and e.g app windows. // windows and e.g app windows.
const CommandLine& command_line = *CommandLine::ForCurrentProcess(); const CommandLine& command_line = *CommandLine::ForCurrentProcess();
const Browser& browser = *browser_view_->browser(); const Browser& browser = *browser_view_->browser();
params.wm_class_class = ShellIntegrationLinux::GetProgramClassName(); params.wm_class_class = shell_integration_linux::GetProgramClassName();
params.wm_class_name = params.wm_class_class; params.wm_class_name = params.wm_class_class;
if (browser.is_app() && !browser.is_devtools()) { if (browser.is_app() && !browser.is_devtools()) {
// This window is a hosted app or v1 packaged app. // This window is a hosted app or v1 packaged app.
......
...@@ -21,7 +21,7 @@ bool CreatePlatformShortcuts( ...@@ -21,7 +21,7 @@ bool CreatePlatformShortcuts(
ShortcutCreationReason /*creation_reason*/) { ShortcutCreationReason /*creation_reason*/) {
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
return ShellIntegrationLinux::CreateDesktopShortcut( return shell_integration_linux::CreateDesktopShortcut(
shortcut_info, creation_locations); shortcut_info, creation_locations);
#else #else
return false; return false;
...@@ -31,7 +31,7 @@ bool CreatePlatformShortcuts( ...@@ -31,7 +31,7 @@ bool CreatePlatformShortcuts(
void DeletePlatformShortcuts(const base::FilePath& web_app_path, void DeletePlatformShortcuts(const base::FilePath& web_app_path,
const ShortcutInfo& shortcut_info) { const ShortcutInfo& shortcut_info) {
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
ShellIntegrationLinux::DeleteDesktopShortcuts(shortcut_info.profile_path, shell_integration_linux::DeleteDesktopShortcuts(shortcut_info.profile_path,
shortcut_info.extension_id); shortcut_info.extension_id);
#endif #endif
} }
...@@ -47,7 +47,7 @@ void UpdatePlatformShortcuts( ...@@ -47,7 +47,7 @@ void UpdatePlatformShortcuts(
// Find out whether shortcuts are already installed. // Find out whether shortcuts are already installed.
ShortcutLocations creation_locations = ShortcutLocations creation_locations =
ShellIntegrationLinux::GetExistingShortcutLocations( shell_integration_linux::GetExistingShortcutLocations(
env.get(), shortcut_info.profile_path, shortcut_info.extension_id); env.get(), shortcut_info.profile_path, shortcut_info.extension_id);
// Always create a hidden shortcut in applications if a visible one is not // Always create a hidden shortcut in applications if a visible one is not
// being created. This allows the operating system to identify the app, but // being created. This allows the operating system to identify the app, but
...@@ -63,7 +63,7 @@ void UpdatePlatformShortcuts( ...@@ -63,7 +63,7 @@ void UpdatePlatformShortcuts(
void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
ShellIntegrationLinux::DeleteAllDesktopShortcuts(profile_path); shell_integration_linux::DeleteAllDesktopShortcuts(profile_path);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment