diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-30 22:13:32 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-30 22:13:32 +0000 |
commit | b99603ceb9cbec4a3b1ca9ac535f6b1cbc951bb8 (patch) | |
tree | 2f9074d5ad8acf95156fc9c390646eca935d232e /chrome | |
parent | 004f2cf5d5eb19764260b1f513738be15ae77d47 (diff) | |
download | chromium_src-b99603ceb9cbec4a3b1ca9ac535f6b1cbc951bb8.zip chromium_src-b99603ceb9cbec4a3b1ca9ac535f6b1cbc951bb8.tar.gz chromium_src-b99603ceb9cbec4a3b1ca9ac535f6b1cbc951bb8.tar.bz2 |
Move some functions out of win_util and into hwnd_util, and into a new win/shell file.
This also moves two functions that were only called once from win_util and inwo window_win and download_util, respectively.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/6035011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/aeropeek_manager.cc | 7 | ||||
-rw-r--r-- | chrome/browser/download/download_util.cc | 35 | ||||
-rw-r--r-- | chrome/browser/platform_util_win.cc | 3 | ||||
-rw-r--r-- | chrome/browser/themes/browser_theme_provider.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/browser.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/constrained_window_win.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/views/first_run_bubble.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_frame_win.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/infobars/infobars.cc | 3 | ||||
-rw-r--r-- | chrome/common/win_safe_util.cc | 6 |
11 files changed, 58 insertions, 20 deletions
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc index e628224..5281f8d 100644 --- a/chrome/browser/aeropeek_manager.cc +++ b/chrome/browser/aeropeek_manager.cc @@ -7,8 +7,9 @@ #include <dwmapi.h> #include <shobjidl.h> +#include "app/win/hwnd_util.h" #include "app/win/window_impl.h" -#include "app/win_util.h" +#include "app/win/shell.h" #include "base/command_line.h" #include "base/scoped_comptr_win.h" #include "base/scoped_handle_win.h" @@ -251,7 +252,7 @@ class RegisterThumbnailTask : public Task { // browser icon in the taskbar. // TODO(mattm): This should use ShellIntegration::GetChromiumAppId to work // properly with multiple profiles. - win_util::SetAppIdForWindow( + app::win::SetAppIdForWindow( BrowserDistribution::GetDistribution()->GetBrowserAppId(), window_); // Register this place-holder window to the taskbar as a child of @@ -1013,7 +1014,7 @@ bool AeroPeekManager::Enabled() { // flooding users with tab thumbnails. const CommandLine* command_line = CommandLine::ForCurrentProcess(); return base::win::GetVersion() >= base::win::VERSION_WIN7 && - win_util::ShouldUseVistaFrame() && + app::win::ShouldUseVistaFrame() && !command_line->HasSwitch(switches::kApp) && command_line->HasSwitch(switches::kEnableAeroPeekTabs); } diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 1854d11..92c24a3 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -92,6 +92,39 @@ static const int kCompleteAnimationCycles = 5; // Also used by code that cleans up said files. static const int kMaxUniqueFiles = 100; +namespace { + +#if defined(OS_WIN) +// Returns whether the specified extension is automatically integrated into the +// windows shell. +bool IsShellIntegratedExtension(const string16& extension) { + string16 extension_lower = StringToLowerASCII(extension); + + static const wchar_t* const integrated_extensions[] = { + // See <http://msdn.microsoft.com/en-us/library/ms811694.aspx>. + L"local", + // Right-clicking on shortcuts can be magical. + L"lnk", + }; + + for (int i = 0; i < arraysize(integrated_extensions); ++i) { + if (extension_lower == integrated_extensions[i]) + return true; + } + + // See <http://www.juniper.net/security/auto/vulnerabilities/vuln2612.html>. + // That vulnerability report is not exactly on point, but files become magical + // if their end in a CLSID. Here we block extensions that look like CLSIDs. + if (extension_lower.size() > 0 && extension_lower.at(0) == L'{' && + extension_lower.at(extension_lower.length() - 1) == L'}') + return true; + + return false; +} +#endif // OS_WIN + +} // namespace + // Download temporary file creation -------------------------------------------- class DefaultDownloadDirectory { @@ -157,7 +190,7 @@ void GenerateExtension(const FilePath& file_name, FILE_PATH_LITERAL("download"); // Rename shell-integrated extensions. - if (win_util::IsShellIntegratedExtension(extension)) + if (IsShellIntegratedExtension(extension)) extension.assign(default_extension); #endif diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc index f27e936..9672d02 100644 --- a/chrome/browser/platform_util_win.cc +++ b/chrome/browser/platform_util_win.cc @@ -9,6 +9,7 @@ #include <shellapi.h> #include <shlobj.h> +#include "app/win/shell.h" #include "app/win_util.h" #include "base/file_path.h" #include "base/file_util.h" @@ -89,7 +90,7 @@ void ShowItemInFolder(const FilePath& full_path) { } void OpenItem(const FilePath& full_path) { - win_util::OpenItemViaShell(full_path); + app::win::OpenItemViaShell(full_path); } void OpenExternal(const GURL& url) { diff --git a/chrome/browser/themes/browser_theme_provider.cc b/chrome/browser/themes/browser_theme_provider.cc index 1f70532..bdd9bf1 100644 --- a/chrome/browser/themes/browser_theme_provider.cc +++ b/chrome/browser/themes/browser_theme_provider.cc @@ -20,7 +20,7 @@ #include "grit/theme_resources.h" #if defined(OS_WIN) -#include "app/win_util.h" +#include "app/win/hwnd_util.h" #endif // Strings used in alignment properties. @@ -255,7 +255,7 @@ bool BrowserThemeProvider::ShouldUseNativeFrame() const { if (HasCustomImage(IDR_THEME_FRAME)) return false; #if defined(OS_WIN) - return win_util::ShouldUseVistaFrame(); + return app::win::ShouldUseVistaFrame(); #else return false; #endif diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 52a3b96..a9a731e 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -116,7 +116,7 @@ #endif #if defined(OS_WIN) -#include "app/win_util.h" +#include "app/win/shell.h" #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" #include "chrome/browser/browser_child_process_host.h" #include "chrome/browser/download/save_package.h" @@ -379,7 +379,7 @@ void Browser::CreateBrowserWindow() { // Set the app user model id for this application to that of the application // name. See http://crbug.com/7028. - win_util::SetAppIdForWindow( + app::win::SetAppIdForWindow( type_ & TYPE_APP ? ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) : ShellIntegration::GetChromiumAppId(profile_->GetPath()), diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc index 199e631..28bd95e 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -42,7 +42,7 @@ #include <commctrl.h> #include <dwmapi.h> -#include "app/win_util.h" +#include "app/win/hwnd_util.h" #include "base/win/scoped_gdi_object.h" #endif @@ -1106,7 +1106,7 @@ void AutocompletePopupContentsView::MakeContentsPath( void AutocompletePopupContentsView::UpdateBlurRegion() { #if defined(OS_WIN) // We only support background blurring on Vista with Aero-Glass enabled. - if (!win_util::ShouldUseVistaFrame() || !GetWidget()) + if (!app::win::ShouldUseVistaFrame() || !GetWidget()) return; // Provide a blurred background effect within the contents region of the diff --git a/chrome/browser/ui/views/constrained_window_win.cc b/chrome/browser/ui/views/constrained_window_win.cc index b042f5b..fea24e2 100644 --- a/chrome/browser/ui/views/constrained_window_win.cc +++ b/chrome/browser/ui/views/constrained_window_win.cc @@ -5,6 +5,7 @@ #include "chrome/browser/views/constrained_window_win.h" #include "app/resource_bundle.h" +#include "app/win/hwnd_util.h" #include "app/win_util.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/prefs/pref_service.h" @@ -197,7 +198,7 @@ class ConstrainedWindowFrameView SkColor GetTitleColor() const { return (container_->owner()->profile()->IsOffTheRecord() || - !win_util::ShouldUseVistaFrame()) ? SK_ColorWHITE : SK_ColorBLACK; + !app::win::ShouldUseVistaFrame()) ? SK_ColorWHITE : SK_ColorBLACK; } // Loads the appropriate set of WindowResources for the frame view. @@ -534,7 +535,7 @@ gfx::Rect ConstrainedWindowFrameView::CalculateClientAreaBounds( } void ConstrainedWindowFrameView::InitWindowResources() { - resources_.reset(win_util::ShouldUseVistaFrame() ? + resources_.reset(app::win::ShouldUseVistaFrame() ? static_cast<views::WindowResources*>(new VistaWindowResources) : new XPWindowResources); } diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc index b858e21..1aa3e98 100644 --- a/chrome/browser/ui/views/first_run_bubble.cc +++ b/chrome/browser/ui/views/first_run_bubble.cc @@ -7,7 +7,7 @@ #include "app/gfx/font_util.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/win_util.h" +#include "app/win/hwnd_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_window.h" @@ -350,7 +350,7 @@ gfx::Size FirstRunOEMBubbleView::GetPreferredSize() { // now, we force Vista to show a correctly-sized box by taking account of // the difference in font size calculation. The coefficient should not be // stored in a variable because it's a hack and should go away. - if (win_util::ShouldUseVistaFrame()) { + if (app::win::ShouldUseVistaFrame()) { size.set_width(static_cast<int>(size.width() * 0.85)); size.set_height(static_cast<int>(size.height() * 0.85)); } diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc index d747f73..1fe8a6c 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -9,6 +9,7 @@ #include <set> +#include "app/win/hwnd_util.h" #include "app/win_util.h" #include "base/win_util.h" #include "chrome/browser/accessibility/browser_accessibility_state.h" @@ -108,7 +109,7 @@ bool BrowserFrameWin::AlwaysUseNativeFrame() const { // We don't theme popup or app windows, so regardless of whether or not a // theme is active for normal browser windows, we don't want to use the custom // frame for popups/apps. - if (!browser_view_->IsBrowserTypeNormal() && win_util::ShouldUseVistaFrame()) + if (!browser_view_->IsBrowserTypeNormal() && app::win::ShouldUseVistaFrame()) return true; // Otherwise, we use the native frame when we're told we should by the theme diff --git a/chrome/browser/ui/views/infobars/infobars.cc b/chrome/browser/ui/views/infobars/infobars.cc index 756ce70..0e08d7b 100644 --- a/chrome/browser/ui/views/infobars/infobars.cc +++ b/chrome/browser/ui/views/infobars/infobars.cc @@ -7,6 +7,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/slide_animation.h" +#include "app/win/hwnd_util.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "chrome/browser/views/event_utils.h" @@ -243,7 +244,7 @@ void InfoBar::AnimateClose() { // Do not restore focus (and active state with it) on Windows if some other // top-level window became active. if (GetWidget() && - !win_util::DoesWindowBelongToActiveWindow(GetWidget()->GetNativeView())) { + !app::win::DoesWindowBelongToActiveWindow(GetWidget()->GetNativeView())) { restore_focus = false; } #endif // defined(OS_WIN) diff --git a/chrome/common/win_safe_util.cc b/chrome/common/win_safe_util.cc index dc5cc25..37cb0a7 100644 --- a/chrome/common/win_safe_util.cc +++ b/chrome/common/win_safe_util.cc @@ -7,7 +7,7 @@ #include "chrome/common/win_safe_util.h" -#include "app/win_util.h" +#include "app/win/shell.h" #include "base/file_path.h" #include "base/logging.h" #include "base/path_service.h" @@ -33,7 +33,7 @@ bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title, NOTREACHED(); return false; } - return OpenItemViaShell(full_path); + return app::win::OpenItemViaShell(full_path); } // This GUID is associated with any 'don't ask me again' settings that the @@ -81,7 +81,7 @@ bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title, return false; } } - return OpenItemViaShellNoZoneCheck(full_path); + return app::win::OpenItemViaShellNoZoneCheck(full_path); } bool SetInternetZoneIdentifier(const FilePath& full_path) { |