diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-20 22:29:10 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-20 22:29:10 +0000 |
commit | 8ee065422af7e53091a8bc7a98e6d4c0cd4ff9b8 (patch) | |
tree | 41e50a5122cb5e294d598fd0143269ced75f907c | |
parent | 899487fdde6741f2b380986cef34140bb48621fd (diff) | |
download | chromium_src-8ee065422af7e53091a8bc7a98e6d4c0cd4ff9b8.zip chromium_src-8ee065422af7e53091a8bc7a98e6d4c0cd4ff9b8.tar.gz chromium_src-8ee065422af7e53091a8bc7a98e6d4c0cd4ff9b8.tar.bz2 |
Removes win8_util
IsSingleWindowMetroMode is always false not that we only use ash.
BUG=none
TEST=none
R=ananta@chromium.org
Review URL: https://codereview.chromium.org/243703003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264957 0039d316-1c4b-4281-b951-d872f2087c98
46 files changed, 63 insertions, 1274 deletions
diff --git a/chrome/browser/download/download_status_updater_win.cc b/chrome/browser/download/download_status_updater_win.cc index f63808a..35d82b2 100644 --- a/chrome/browser/download/download_status_updater_win.cc +++ b/chrome/browser/download/download_status_updater_win.cc @@ -7,30 +7,18 @@ #include <shobjidl.h> #include <string> -#include "base/files/file_path.h" #include "base/logging.h" -#include "base/stl_util.h" -#include "base/strings/string_number_conversions.h" -#include "base/win/metro.h" #include "base/win/scoped_comptr.h" #include "base/win/windows_version.h" -#include "chrome/browser/platform_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_iterator.h" #include "chrome/browser/ui/browser_window.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/views/win/hwnd_util.h" -#include "url/gurl.h" -#include "win8/util/win8_util.h" namespace { -const char kDownloadNotificationPrefix[] = "DownloadNotification"; -int g_next_notification_id = 0; - void UpdateTaskbarProgressBar(int download_count, bool progress_known, float progress) { @@ -68,18 +56,6 @@ void UpdateTaskbarProgressBar(int download_count, } } -void MetroDownloadNotificationClickedHandler(const wchar_t* download_path) { - // Metro chrome will invoke these handlers on the metro thread. - DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - - // Ensure that we invoke the function to display the downloaded item on the - // UI thread. - content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, - base::Bind(platform_util::ShowItemInFolder, - static_cast<Profile*>(NULL), - base::FilePath(download_path))); -} - } // namespace void DownloadStatusUpdater::UpdateAppIconDownloadProgress( @@ -90,60 +66,4 @@ void DownloadStatusUpdater::UpdateAppIconDownloadProgress( int download_count = 0; bool progress_known = GetProgress(&progress, &download_count); UpdateTaskbarProgressBar(download_count, progress_known, progress); - - // Fire notifications when downloads complete. - if (!win8::IsSingleWindowMetroMode()) - return; - - if (download->GetState() != content::DownloadItem::COMPLETE) - return; - - if (download->GetOpenWhenComplete() || - download->ShouldOpenFileBasedOnExtension() || - download->IsTemporary() || - download->GetAutoOpened()) - return; - - // Don't display the Windows8 metro notifications for an incognito download. - if (download->GetBrowserContext() && - download->GetBrowserContext()->IsOffTheRecord()) - return; - - // Don't display the Windows 8 metro notifications if we are in the - // foreground. - HWND foreground_window = ::GetForegroundWindow(); - if (::IsWindow(foreground_window)) { - DWORD process_id = 0; - ::GetWindowThreadProcessId(foreground_window, &process_id); - if (process_id == ::GetCurrentProcessId()) - return; - } - - // In Windows 8 metro mode display a metro style notification which - // informs the user that the download is complete. - HMODULE metro = base::win::GetMetroModule(); - base::win::MetroNotification display_notification = - reinterpret_cast<base::win::MetroNotification>( - ::GetProcAddress(metro, "DisplayNotification")); - DCHECK(display_notification); - if (display_notification) { - base::string16 title = l10n_util::GetStringUTF16( - IDS_METRO_DOWNLOAD_COMPLETE_NOTIFICATION_TITLE); - base::string16 body = l10n_util::GetStringUTF16( - IDS_METRO_DOWNLOAD_COMPLETE_NOTIFICATION); - - // Dummy notification id. Every metro style notification needs a - // unique notification id. - std::string notification_id = kDownloadNotificationPrefix; - notification_id += base::IntToString(g_next_notification_id++); - - display_notification(download->GetURL().spec().c_str(), - "", - title.c_str(), - body.c_str(), - L"", - notification_id.c_str(), - MetroDownloadNotificationClickedHandler, - download->GetTargetFilePath().value().c_str()); - } } diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc index ae04f90..8b3579e 100644 --- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc +++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc @@ -39,10 +39,6 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/webui/web_ui_util.h" -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif // OS_WIN - namespace extensions { namespace bookmark_keys = bookmark_api_constants; @@ -629,12 +625,6 @@ bool BookmarkManagerPrivateSetMetaInfoFunction::RunImpl() { bool BookmarkManagerPrivateCanOpenNewWindowsFunction::RunImpl() { bool can_open_new_windows = true; - -#if defined(OS_WIN) - if (win8::IsSingleWindowMetroMode()) - can_open_new_windows = false; -#endif // OS_WIN - SetResult(new base::FundamentalValue(can_open_new_windows)); return true; } diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index 8f0fa27..32d114d 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc @@ -84,10 +84,6 @@ #include "ui/base/models/list_selection_model.h" #include "ui/base/ui_base_types.h" -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif // OS_WIN - #if defined(USE_ASH) #include "apps/app_window_registry.h" #include "ash/ash_switches.h" @@ -189,29 +185,6 @@ bool MatchesBool(bool* boolean, bool value) { return !boolean || *boolean == value; } -Browser* CreateBrowserWindow(const Browser::CreateParams& params, - Profile* profile, - const std::string& extension_id) { - bool use_existing_browser_window = false; - -#if defined(OS_WIN) - // In windows 8 metro mode we don't allow windows to be created. - if (win8::IsSingleWindowMetroMode()) - use_existing_browser_window = true; -#endif // OS_WIN - - Browser* new_window = NULL; - if (use_existing_browser_window) - // The false parameter passed below is to ensure that we find a browser - // object matching the profile passed in, instead of the original profile - new_window = chrome::FindTabbedBrowser(profile, false, - params.host_desktop_type); - - if (!new_window) - new_window = new Browser(params); - return new_window; -} - } // namespace // Windows --------------------------------------------------------------------- @@ -572,8 +545,7 @@ bool WindowsCreateFunction::RunImpl() { create_params.initial_show_state = ui::SHOW_STATE_NORMAL; create_params.host_desktop_type = chrome::GetActiveDesktop(); - Browser* new_window = CreateBrowserWindow(create_params, window_profile, - extension_id); + Browser* new_window = new Browser(create_params); for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) { WebContents* tab = chrome::AddSelectedTabWithURL( @@ -636,14 +608,6 @@ bool WindowsUpdateFunction::RunImpl() { &controller)) return false; -#if defined(OS_WIN) - // Silently ignore changes on the window for metro mode. - if (win8::IsSingleWindowMetroMode()) { - SetResult(controller->CreateWindowValue()); - return true; - } -#endif - ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; // No change. switch (params->update_info.state) { case windows::Update::Params::UpdateInfo::STATE_NORMAL: @@ -764,13 +728,6 @@ bool WindowsRemoveFunction::RunImpl() { &controller)) return false; -#if defined(OS_WIN) - // In Windows 8 metro mode, an existing Browser instance is reused for - // hosting the extension tab. We should not be closing it as we don't own it. - if (win8::IsSingleWindowMetroMode()) - return false; -#endif - WindowController::Reason reason; if (!controller->CanClose(&reason)) { if (reason == WindowController::REASON_NOT_EDITABLE) diff --git a/chrome/browser/extensions/launch_util.cc b/chrome/browser/extensions/launch_util.cc index d24f40e..765e5fc 100644 --- a/chrome/browser/extensions/launch_util.cc +++ b/chrome/browser/extensions/launch_util.cc @@ -17,10 +17,6 @@ #include "extensions/browser/pref_names.h" #include "extensions/common/extension.h" -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif - #if defined(USE_ASH) #include "ash/shell.h" #endif @@ -69,12 +65,6 @@ LaunchType GetLaunchType(const ExtensionPrefs* prefs, result = LAUNCH_TYPE_REGULAR; #endif -#if defined(OS_WIN) - // We don't support app windows in Windows 8 single window Metro mode. - if (win8::IsSingleWindowMetroMode() && result == LAUNCH_TYPE_WINDOW) - result = LAUNCH_TYPE_REGULAR; -#endif // OS_WIN - return result; } diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 6ff1aea..36a4604 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -83,10 +83,6 @@ #include "net/url_request/url_request_throttler_manager.h" #include "net/websockets/websocket_job.h" -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif - #if defined(ENABLE_CONFIGURATION_POLICY) #include "policy/policy_constants.h" #endif diff --git a/chrome/browser/net/proxy_service_factory.cc b/chrome/browser/net/proxy_service_factory.cc index 5933f4a..2c4e9b7 100644 --- a/chrome/browser/net/proxy_service_factory.cc +++ b/chrome/browser/net/proxy_service_factory.cc @@ -26,10 +26,6 @@ #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" #endif // defined(OS_CHROMEOS) -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif - #if !defined(OS_IOS) #include "net/proxy/proxy_resolver_v8.h" #endif diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index ad69727..995c7dd 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -552,7 +552,6 @@ void DesktopNotificationService::RequestPermission( host->DesktopNotificationPermissionRequestDone(callback_context); } -#if !defined(OS_WIN) void DesktopNotificationService::ShowNotification( const Notification& notification) { GetUIManager()->Add(notification, profile_); @@ -564,7 +563,6 @@ bool DesktopNotificationService::CancelDesktopNotification( new NotificationObjectProxy(process_id, route_id, notification_id)); return GetUIManager()->CancelById(proxy->id()); } -#endif // OS_WIN bool DesktopNotificationService::ShowDesktopNotification( const content::ShowDesktopNotificationHostMsgParams& params, diff --git a/chrome/browser/notifications/desktop_notification_service_win.cc b/chrome/browser/notifications/desktop_notification_service_win.cc deleted file mode 100644 index 0a6c2f8..0000000 --- a/chrome/browser/notifications/desktop_notification_service_win.cc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2012 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/notifications/desktop_notification_service.h" - -#include "base/logging.h" -#include "base/win/metro.h" -#include "chrome/browser/notifications/notification.h" -#include "chrome/browser/notifications/notification_object_proxy.h" -#include "chrome/browser/notifications/notification_ui_manager.h" -#include "chrome/browser/notifications/notification_ui_manager.h" -#include "win8/util/win8_util.h" - -bool DesktopNotificationService::CancelDesktopNotification( - int process_id, int route_id, int notification_id) { - scoped_refptr<NotificationObjectProxy> proxy( - new NotificationObjectProxy(process_id, route_id, notification_id)); - if (win8::IsSingleWindowMetroMode()) { - base::win::MetroCancelNotification cancel_metro_notification = - reinterpret_cast<base::win::MetroCancelNotification>(GetProcAddress( - base::win::GetMetroModule(), "CancelNotification")); - DCHECK(cancel_metro_notification); - if (cancel_metro_notification(proxy->id().c_str())) - return true; - } - return GetUIManager()->CancelById(proxy->id()); -} - -void DesktopNotificationService::ShowNotification( - const Notification& notification) { - if (win8::IsSingleWindowMetroMode()) { - base::win::MetroNotification display_metro_notification = - reinterpret_cast<base::win::MetroNotification>(GetProcAddress( - base::win::GetMetroModule(), "DisplayNotification")); - DCHECK(display_metro_notification); - if (!notification.is_html()) { - display_metro_notification(notification.origin_url().spec().c_str(), - notification.content_url().spec().c_str(), - notification.title().c_str(), - notification.message().c_str(), - notification.display_source().c_str(), - notification.notification_id().c_str(), - NULL, NULL); - return; - } else { - NOTREACHED() << "We don't support HTML notifications in Windows 8 metro"; - } - } - GetUIManager()->Add(notification, profile_); -} diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index adfd8f9..b5a7e58 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -56,10 +56,6 @@ #include "chrome/browser/chromeos/boot_times_loader.h" #endif -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif - using content::NavigationController; using content::RenderWidgetHost; using content::WebContents; @@ -833,8 +829,8 @@ class SessionRestoreImpl : public content::NotificationObserver { browser = browser_; } else { #if defined(OS_CHROMEOS) - chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( - "SessionRestore-CreateRestoredBrowser-Start", false); + chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( + "SessionRestore-CreateRestoredBrowser-Start", false); #endif // Show the first window if none are visible. ui::WindowShowState show_state = (*i)->show_state; @@ -842,36 +838,14 @@ class SessionRestoreImpl : public content::NotificationObserver { show_state = ui::SHOW_STATE_NORMAL; has_visible_browser = true; } - browser = NULL; -#if defined(OS_WIN) - if (win8::IsSingleWindowMetroMode()) { - // We don't want to add tabs to the off the record browser. - if (browser_ && !browser_->profile()->IsOffTheRecord()) { - browser = browser_; - } else { - browser = last_browser; - // last_browser should never be off the record either. - // We don't set browser higher above when browser_ is offtherecord, - // and CreateRestoredBrowser below, is never created offtherecord. - DCHECK(!browser || !browser->profile()->IsOffTheRecord()); - } - // Metro should only have tabbed browsers. - // It never creates any non-tabbed browser, and thus should never - // restore non-tabbed items... - DCHECK(!browser || browser->is_type_tabbed()); - DCHECK((*i)->type == Browser::TYPE_TABBED); - } -#endif - if (!browser) { - browser = CreateRestoredBrowser( - static_cast<Browser::Type>((*i)->type), - (*i)->bounds, - show_state, - (*i)->app_name); - } + browser = CreateRestoredBrowser( + static_cast<Browser::Type>((*i)->type), + (*i)->bounds, + show_state, + (*i)->app_name); #if defined(OS_CHROMEOS) - chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( - "SessionRestore-CreateRestoredBrowser-End", false); + chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( + "SessionRestore-CreateRestoredBrowser-End", false); #endif } if ((*i)->type == Browser::TYPE_TABBED) @@ -918,19 +892,8 @@ class SessionRestoreImpl : public content::NotificationObserver { chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( "SessionRestore-CreatingTabs-End", false); #endif - if (browser_to_activate) { + if (browser_to_activate) browser_to_activate->window()->Activate(); -#if defined(OS_WIN) - // On Win8 Metro, we merge all browsers together, so if we need to - // activate one of the previously separated window, we need to activate - // the tab. Also, selected_tab_to_activate can be -1 if we clobbered the - // tab that would have been activated. - // In that case we'll leave activation to last tab. - // The only current usage of clobber is for crash recovery, so it's fine. - if (win8::IsSingleWindowMetroMode() && selected_tab_to_activate != -1) - ShowBrowser(browser_to_activate, selected_tab_to_activate); -#endif - } // If last_browser is NULL and urls_to_open_ is non-empty, // FinishedTabCreation will create a new TabbedBrowser and add the urls to diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc index 9e038ef..aef5067 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc @@ -129,12 +129,6 @@ void BookmarkContextMenuController::ExecuteCommand(int id, int event_flags) { if (delegate_) delegate_->WillExecuteCommand(id, selection_); - if (ExecutePlatformCommand(id, event_flags)) { - if (delegate_) - delegate_->DidExecuteCommand(id); - return; - } - switch (id) { case IDC_BOOKMARK_BAR_OPEN_ALL: case IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO: @@ -323,10 +317,6 @@ bool BookmarkContextMenuController::IsCommandIdChecked(int command_id) const { } bool BookmarkContextMenuController::IsCommandIdEnabled(int command_id) const { - bool enabled = false; - if (IsPlatformCommandIdEnabled(command_id, &enabled)) - return enabled; - PrefService* prefs = profile_->GetPrefs(); bool is_root_node = selection_.size() == 1 && @@ -400,21 +390,6 @@ bool BookmarkContextMenuController::GetAcceleratorForCommandId( return false; } -#if !defined(OS_WIN) -bool BookmarkContextMenuController::IsPlatformCommandIdEnabled( - int command_id, - bool* enabled) const { - // By default, there are no platform-specific enabled or disabled commands. - return false; -} - -bool BookmarkContextMenuController::ExecutePlatformCommand(int id, - int event_flags) { - // By default, there are no platform-specific commands. - return false; -} -#endif // OS_WIN - void BookmarkContextMenuController::BookmarkModelChanged() { if (delegate_) delegate_->CloseMenu(); diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h index b2d14af..056e8eb 100644 --- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h +++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h @@ -76,15 +76,6 @@ class BookmarkContextMenuController : public BaseBookmarkModelObserver, } private: - // A hook so that platform-specific implementations can report which commands - // are enabled. Returns true if |enabled| was set by the platform-specific - // implementation. - bool IsPlatformCommandIdEnabled(int command_id, bool* enabled) const; - - // A hook to execute platform-specific commands. Returns true if the command - // has been handled and should no longer be processed. - bool ExecutePlatformCommand(int command_id, int event_flags); - void BuildMenu(); // Adds a IDC_* style command to the menu with a localized string. diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index f1c2cac..2d7172e 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -360,6 +360,7 @@ class Browser : public TabStripModelObserver, // See the description of // FullscreenController::ToggleFullscreenModeWithExtension. void ToggleFullscreenModeWithExtension(const GURL& extension_url); + #if defined(OS_WIN) // See the description of FullscreenController::ToggleMetroSnapMode. void SetMetroSnapMode(bool enable); diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc index 27c6269..9d9a8e7 100644 --- a/chrome/browser/ui/browser_commands.cc +++ b/chrome/browser/ui/browser_commands.cc @@ -85,7 +85,6 @@ #if defined(OS_WIN) #include "chrome/browser/ui/metro_pin_tab_helper_win.h" -#include "win8/util/win8_util.h" #endif #if defined(ENABLE_PRINTING) @@ -535,7 +534,6 @@ void Stop(Browser* browser) { browser->tab_strip_model()->GetActiveWebContents()->Stop(); } -#if !defined(OS_WIN) void NewWindow(Browser* browser) { NewEmptyWindow(browser->profile()->GetOriginalProfile(), browser->host_desktop_type()); @@ -545,7 +543,6 @@ void NewIncognitoWindow(Browser* browser) { NewEmptyWindow(browser->profile()->GetOffTheRecordProfile(), browser->host_desktop_type()); } -#endif // OS_WIN void CloseWindow(Browser* browser) { content::RecordAction(UserMetricsAction("CloseWindow")); @@ -1010,12 +1007,7 @@ void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action) { bool CanOpenTaskManager() { #if defined(ENABLE_TASK_MANAGER) -#if defined(OS_WIN) - // In metro we can't display the task manager, as it is a native window. - return !win8::IsSingleWindowMetroMode(); -#else return true; -#endif #else return false; #endif diff --git a/chrome/browser/ui/browser_win.cc b/chrome/browser/ui/browser_win.cc index 929573d..0e471a6b 100644 --- a/chrome/browser/ui/browser_win.cc +++ b/chrome/browser/ui/browser_win.cc @@ -4,61 +4,7 @@ #include "chrome/browser/ui/browser.h" -#include "base/strings/utf_string_conversions.h" -#include "base/win/metro.h" -#include "chrome/browser/bookmarks/bookmark_utils.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" -#include "win8/util/win8_util.h" - -namespace { - -void NewWindowMaybeMetro(Browser* source_browser, Profile* profile) { - chrome::HostDesktopType host_desktop_type = - source_browser->host_desktop_type(); - if (win8::IsSingleWindowMetroMode()) { - typedef void (*FlipFrameWindows)(); - - static FlipFrameWindows flip_window_fn = reinterpret_cast<FlipFrameWindows>( - ::GetProcAddress(base::win::GetMetroModule(), "FlipFrameWindows")); - DCHECK(flip_window_fn); - - Browser* browser = chrome::FindTabbedBrowser(profile, false, - host_desktop_type); - - if (!browser) { - chrome::OpenEmptyWindow(profile, host_desktop_type); - return; - } - - chrome::NewTab(browser); - - if (browser != source_browser) { - // Tell the metro_driver to flip our window. This causes the current - // browser window to be hidden and the next window to be shown. - flip_window_fn(); - } - } else { - NewEmptyWindow(profile, host_desktop_type); - } -} - -} // namespace - -namespace chrome { - -void NewWindow(Browser* browser) { - NewWindowMaybeMetro(browser, browser->profile()->GetOriginalProfile()); -} - -void NewIncognitoWindow(Browser* browser) { - NewWindowMaybeMetro(browser, browser->profile()->GetOffTheRecordProfile()); -} - -} // namespace chrome void Browser::SetMetroSnapMode(bool enable) { fullscreen_controller_->SetMetroSnapMode(enable); diff --git a/chrome/browser/ui/extensions/application_launch.cc b/chrome/browser/ui/extensions/application_launch.cc index fc131d5..7aa201b 100644 --- a/chrome/browser/ui/extensions/application_launch.cc +++ b/chrome/browser/ui/extensions/application_launch.cc @@ -53,10 +53,6 @@ #include "chrome/browser/ui/browser_commands_mac.h" #endif -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif - using content::WebContents; using extensions::Extension; using extensions::ExtensionPrefs; @@ -215,17 +211,7 @@ WebContents* OpenApplicationWindow(const AppLaunchParams& params) { params.container, extension); - Browser* browser = NULL; -#if defined(OS_WIN) - // On Windows 8's single window Metro mode we don't allow multiple Chrome - // windows to be created. We instead attempt to reuse an existing Browser - // window. - if (win8::IsSingleWindowMetroMode()) - browser = chrome::FindBrowserWithProfile(profile, params.desktop_type); - -#endif - if (!browser) - browser = new Browser(browser_params); + Browser* browser = new Browser(browser_params); WebContents* web_contents = chrome::AddSelectedTabWithURL( browser, url, content::PAGE_TRANSITION_AUTO_TOPLEVEL); diff --git a/chrome/browser/ui/panels/panel_manager.cc b/chrome/browser/ui/panels/panel_manager.cc index da61f92..afddc37 100644 --- a/chrome/browser/ui/panels/panel_manager.cc +++ b/chrome/browser/ui/panels/panel_manager.cc @@ -27,10 +27,6 @@ #include "ui/base/x/x11_util.h" #endif -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif - namespace { // Maxmium width of a panel is based on a factor of the working area. #if defined(OS_CHROMEOS) @@ -124,12 +120,6 @@ bool PanelManager::ShouldUsePanels(const std::string& extension_id) { } #endif // USE_X11 && !OS_CHROMEOS -#if defined(OS_WIN) - // No panels in Metro mode. - if (win8::IsSingleWindowMetroMode()) - return false; -#endif // OS_WIN - chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); if (channel == chrome::VersionInfo::CHANNEL_STABLE || channel == chrome::VersionInfo::CHANNEL_BETA) { diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index 1672f35..c22ed67 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc @@ -85,10 +85,6 @@ #include "ui/events/x/touch_factory_x11.h" #endif -#if defined(OS_WIN) -#include "chrome/browser/ui/startup/startup_browser_creator_win.h" -#endif - #if defined(ENABLE_FULL_PRINTING) #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.h" @@ -450,16 +446,6 @@ std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine( } } } -#if defined(OS_WIN) - if (urls.empty()) { - // If we are in Windows 8 metro mode and were launched as a result of the - // search charm or via a url navigation in metro, then fetch the - // corresponding url. - GURL url(chrome::GetURLToOpen(profile)); - if (url.is_valid()) - urls.push_back(url); - } -#endif // OS_WIN return urls; } diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 58995aa..5d346ac 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -590,9 +590,6 @@ void StartupBrowserCreatorImpl::ProcessLaunchURLs( std::vector<GURL> adjust_urls = urls_to_open; if (adjust_urls.empty()) { AddStartupURLs(&adjust_urls); - if (StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( - profile_, adjust_urls)) - return; } else if (!command_line_.HasSwitch(switches::kOpenInNewWindow)) { // Always open a list of urls in a window on the native desktop. browser = chrome::FindTabbedBrowser(profile_, false, @@ -940,12 +937,3 @@ void StartupBrowserCreatorImpl::AddStartupURLs( } } } - -#if !defined(OS_WIN) -// static -bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( - Profile* profile, - const std::vector<GURL>& startup_urls) { - return false; -} -#endif diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.h b/chrome/browser/ui/startup/startup_browser_creator_impl.h index b1e86cd..8103e20 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.h +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.h @@ -145,12 +145,6 @@ class StartupBrowserCreatorImpl { // that case. void CheckPreferencesBackup(Profile* profile); - // Function to open startup urls in an existing Browser instance for the - // profile passed in. Returns true on success. - static bool OpenStartupURLsInExistingBrowser( - Profile* profile, - const std::vector<GURL>& startup_urls); - const base::FilePath cur_dir_; const base::CommandLine& command_line_; Profile* profile_; diff --git a/chrome/browser/ui/startup/startup_browser_creator_win.cc b/chrome/browser/ui/startup/startup_browser_creator_win.cc deleted file mode 100644 index f946e77..0000000 --- a/chrome/browser/ui/startup/startup_browser_creator_win.cc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2012 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/ui/startup/startup_browser_creator_win.h" - -#include "base/logging.h" -#include "base/win/metro.h" -#include "chrome/browser/search_engines/util.h" -#include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/startup/startup_browser_creator_impl.h" -#include "chrome/common/url_constants.h" -#include "win8/util/win8_util.h" - -namespace chrome { - -GURL GetURLToOpen(Profile* profile) { - base::string16 params; - base::win::MetroLaunchType launch_type = - base::win::GetMetroLaunchParams(¶ms); - if ((launch_type == base::win::METRO_PROTOCOL) || - (launch_type == base::win::METRO_LAUNCH)) - return GURL(params); - return (launch_type == base::win::METRO_SEARCH) ? - GetDefaultSearchURLForSearchTerms(profile, params) : GURL(); -} - -} // namespace chrome - -// static -bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( - Profile* profile, - const std::vector<GURL>& startup_urls) { - if (!win8::IsSingleWindowMetroMode()) - return false; - - // We activate an existing browser window if we are opening just the new tab - // page in metro mode. - if (startup_urls.size() > 1) - return false; - - if (startup_urls[0] != GURL(chrome::kChromeUINewTabURL)) - return false; - - Browser* browser = chrome::FindBrowserWithProfile( - profile, chrome::HOST_DESKTOP_TYPE_NATIVE); - - if (!browser) - return false; - - browser->window()->Show(); - return true; -} diff --git a/chrome/browser/ui/startup/startup_browser_creator_win.h b/chrome/browser/ui/startup/startup_browser_creator_win.h deleted file mode 100644 index ce65d9f..0000000 --- a/chrome/browser/ui/startup/startup_browser_creator_win.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2012 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_UI_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_ -#define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_ - -class GURL; -class Profile; - -namespace chrome { - -// If we are in Windows 8 metro mode and were launched as a result of the search -// charm or via a url navigation in metro, then this function fetches the -// url/search term from the metro driver. -GURL GetURLToOpen(Profile* profile); - -} // namespace chrome - -#endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_ diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index e2ca7b5..13dc110 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -66,7 +66,6 @@ #include "chrome/browser/enumerate_modules_model_win.h" #include "chrome/browser/ui/metro_pin_tab_helper_win.h" #include "content/public/browser/gpu_data_manager.h" -#include "win8/util/win8_util.h" #endif #if defined(USE_ASH) @@ -482,33 +481,9 @@ bool WrenchMenuModel::ShouldShowNewIncognitoWindowMenuItem() { if (browser_->profile()->IsManaged()) return false; -#if defined(OS_WIN) - if (win8::IsSingleWindowMetroMode() && - browser_->profile()->HasOffTheRecordProfile()) { - return false; - } -#endif - return !browser_->profile()->IsGuestSession(); } -bool WrenchMenuModel::ShouldShowNewWindowMenuItem() { -#if defined(OS_WIN) - if (!win8::IsSingleWindowMetroMode()) - return true; - - // In Win8's single window Metro mode, we only show the New Window options - // if there isn't already a window of the requested type (incognito or not) - // that is available. - return browser_->profile()->IsOffTheRecord() && - !chrome::FindBrowserWithProfile( - browser_->profile()->GetOriginalProfile(), - browser_->host_desktop_type()); -#else - return true; -#endif -} - void WrenchMenuModel::Build(bool is_new_menu) { #if defined(OS_WIN) AddItem(IDC_VIEW_INCOMPATIBILITIES, @@ -521,8 +496,7 @@ void WrenchMenuModel::Build(bool is_new_menu) { #endif AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); - if (ShouldShowNewWindowMenuItem()) - AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); + AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); if (ShouldShowNewIncognitoWindowMenuItem()) AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.h b/chrome/browser/ui/toolbar/wrench_menu_model.h index 9d38635..5dabbb5 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.h +++ b/chrome/browser/ui/toolbar/wrench_menu_model.h @@ -160,7 +160,6 @@ class WrenchMenuModel : public ui::SimpleMenuModel, void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); bool ShouldShowNewIncognitoWindowMenuItem(); - bool ShouldShowNewWindowMenuItem(); // Models for the special menu items with buttons. scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_win.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_win.cc deleted file mode 100644 index 5c1f8f9..0000000 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_win.cc +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2012 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/ui/bookmarks/bookmark_context_menu_controller.h" - -#include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/bookmarks/bookmark_stats.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/bookmarks/bookmark_utils.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "content/public/browser/page_navigator.h" -#include "content/public/browser/user_metrics.h" -#include "content/public/browser/web_contents.h" -#include "win8/util/win8_util.h" - -using base::UserMetricsAction; -using content::OpenURLParams; -using content::PageNavigator; -using content::WebContents; - -namespace { - -// A PageNavigator implementation that creates a new Browser. This is used when -// opening a url and there is no Browser open. The Browser is created the first -// time the PageNavigator method is invoked. -class NewBrowserPageNavigator : public PageNavigator { - public: - explicit NewBrowserPageNavigator(Profile* profile) - : profile_(profile), - browser_(NULL) {} - - virtual ~NewBrowserPageNavigator() { - if (browser_) - browser_->window()->Show(); - } - - Browser* browser() const { return browser_; } - - virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE { - if (!browser_) { - Profile* profile = (params.disposition == OFF_THE_RECORD) ? - profile_->GetOffTheRecordProfile() : profile_; - browser_ = new Browser(Browser::CreateParams(profile, - chrome::GetActiveDesktop())); - } - - OpenURLParams forward_params = params; - forward_params.disposition = NEW_FOREGROUND_TAB; - return browser_->OpenURL(forward_params); - } - - private: - Profile* profile_; - Browser* browser_; - - DISALLOW_COPY_AND_ASSIGN(NewBrowserPageNavigator); -}; - -} // namespace - -bool BookmarkContextMenuController::IsPlatformCommandIdEnabled( - int command_id, - bool* enabled) const { - // In Windows 8 metro mode no new window option on a regular chrome window - // and no new incognito window option on an incognito chrome window. - if (win8::IsSingleWindowMetroMode()) { - if (command_id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW && - !profile_->IsOffTheRecord()) { - *enabled = false; - return true; - } else if (command_id == IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO && - profile_->IsOffTheRecord()) { - *enabled = false; - return true; - } - } - return false; -} - -bool BookmarkContextMenuController::ExecutePlatformCommand(int command_id, - int event_flags) { - if (win8::IsSingleWindowMetroMode()) { - switch (command_id) { - // We need to handle the open in new window and open in incognito window - // commands to ensure that they first look for an existing browser object - // to handle the request. If we find one then a new foreground tab is - // opened, else a new browser object is created. - case IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW: - case IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO: { - Profile* profile_to_use = profile_; - if (command_id == IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW) { - if (profile_to_use->IsOffTheRecord()) - profile_to_use = profile_to_use->GetOriginalProfile(); - - content::RecordAction( - UserMetricsAction("BookmarkBar_ContextMenu_OpenAllInNewWindow")); - } else { - if (!profile_to_use->IsOffTheRecord()) - profile_to_use = profile_to_use->GetOffTheRecordProfile(); - - content::RecordAction( - UserMetricsAction("BookmarkBar_ContextMenu_OpenAllIncognito")); - } - - NewBrowserPageNavigator navigator_impl(profile_to_use); - - // TODO(robertshield): FTB - Switch this to HOST_DESKTOP_TYPE_ASH when - // we make that the default for metro. - Browser* browser = - chrome::FindTabbedBrowser(profile_to_use, - false, - chrome::HOST_DESKTOP_TYPE_NATIVE); - PageNavigator* navigator = NULL; - if (!browser || !browser->tab_strip_model()->GetActiveWebContents()) { - navigator = &navigator_impl; - } else { - browser->window()->Activate(); - navigator = browser->tab_strip_model()->GetActiveWebContents(); - } - - chrome::OpenAll(parent_window_, navigator, selection_, - NEW_FOREGROUND_TAB, profile_to_use); - for (size_t i = 0; i < selection_.size(); ++i) { - RecordBookmarkLaunch(selection_[i], - BOOKMARK_LAUNCH_LOCATION_CONTEXT_MENU); - } - return true; - } - - default: - break; - } - } - - return false; -} diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index ae5737e..0c12b67 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -155,7 +155,6 @@ #include "base/win/windows_version.h" #include "chrome/browser/jumplist_win.h" #include "ui/views/win/scoped_fullscreen_visibility.h" -#include "win8/util/win8_util.h" #endif #if defined(ENABLE_ONE_CLICK_SIGNIN) @@ -245,20 +244,6 @@ void PaintAttachedBookmarkBar(gfx::Canvas* canvas, // static const char BrowserView::kViewClassName[] = "BrowserView"; -namespace { - -bool ShouldSaveOrRestoreWindowPos() { -#if defined(OS_WIN) - // In Windows 8's single window Metro mode the window is always maximized - // (without the WS_MAXIMIZE style). - if (win8::IsSingleWindowMetroMode()) - return false; -#endif - return true; -} - -} // namespace - /////////////////////////////////////////////////////////////////////////////// // Delegate implementation for BrowserViewLayout. Usually just forwards calls @@ -571,17 +556,9 @@ bool BrowserView::IsRegularOrGuestSession() const { } int BrowserView::GetOTRIconResourceID() const { - int otr_resource_id = IDR_OTR_ICON; - if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { - if (IsFullscreen()) - otr_resource_id = IDR_OTR_ICON_FULLSCREEN; -#if defined(OS_WIN) - if (win8::IsSingleWindowMetroMode()) - otr_resource_id = IDR_OTR_ICON_FULLSCREEN; -#endif - } - - return otr_resource_id; + if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH && IsFullscreen()) + return IDR_OTR_ICON_FULLSCREEN; + return IDR_OTR_ICON; } int BrowserView::GetGuestIconResourceID() const { @@ -1428,12 +1405,7 @@ void BrowserView::Paste() { WindowOpenDisposition BrowserView::GetDispositionForPopupBounds( const gfx::Rect& bounds) { -#if defined(OS_WIN) - // If we are in Win8's single window Metro mode, we can't allow popup windows. - return win8::IsSingleWindowMetroMode() ? NEW_BACKGROUND_TAB : NEW_POPUP; -#else return NEW_POPUP; -#endif } FindBar* BrowserView::CreateFindBar() { @@ -1632,17 +1604,6 @@ bool BrowserView::ExecuteWindowsCommand(int command_id) { #if defined(OS_WIN) if (command_id == IDC_DEBUG_FRAME_TOGGLE) GetWidget()->DebugToggleFrameType(); - - // In Windows 8 metro mode prevent sizing and moving. - if (win8::IsSingleWindowMetroMode()) { - // Windows uses the 4 lower order bits of |notification_code| for type- - // specific information so we must exclude this when comparing. - static const int sc_mask = 0xFFF0; - if (((command_id & sc_mask) == SC_MOVE) || - ((command_id & sc_mask) == SC_SIZE) || - ((command_id & sc_mask) == SC_MAXIMIZE)) - return true; - } #endif // Translate WM_APPCOMMAND command ids into a command id that the browser // knows how to handle. @@ -1662,9 +1623,6 @@ void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds, // If IsFullscreen() is true, we've just changed into fullscreen mode, and // we're catching the going-into-fullscreen sizing and positioning calls, // which we want to ignore. - if (!ShouldSaveOrRestoreWindowPos()) - return; - if (!IsFullscreen() && chrome::ShouldSaveWindowPlacement(browser_.get())) { WidgetDelegate::SaveWindowPlacement(bounds, show_state); chrome::SaveWindowPlacement(browser_.get(), bounds, show_state); @@ -1675,8 +1633,6 @@ bool BrowserView::GetSavedWindowPlacement( const views::Widget* widget, gfx::Rect* bounds, ui::WindowShowState* show_state) const { - if (!ShouldSaveOrRestoreWindowPos()) - return false; chrome::GetSavedWindowBoundsAndShowState(browser_.get(), bounds, show_state); if (browser_->is_type_popup() && diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index 93f8c9b..002a54a 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -101,32 +101,30 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, frame_background_(new views::FrameBackground()) { SetLayoutManager(layout_); - if (OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons()) { - minimize_button_ = InitWindowCaptionButton(IDR_MINIMIZE, - IDR_MINIMIZE_H, - IDR_MINIMIZE_P, - IDR_MINIMIZE_BUTTON_MASK, - IDS_ACCNAME_MINIMIZE, - VIEW_ID_MINIMIZE_BUTTON); - maximize_button_ = InitWindowCaptionButton(IDR_MAXIMIZE, - IDR_MAXIMIZE_H, - IDR_MAXIMIZE_P, - IDR_MAXIMIZE_BUTTON_MASK, - IDS_ACCNAME_MAXIMIZE, - VIEW_ID_MAXIMIZE_BUTTON); - restore_button_ = InitWindowCaptionButton(IDR_RESTORE, - IDR_RESTORE_H, - IDR_RESTORE_P, - IDR_RESTORE_BUTTON_MASK, - IDS_ACCNAME_RESTORE, - VIEW_ID_RESTORE_BUTTON); - close_button_ = InitWindowCaptionButton(IDR_CLOSE, - IDR_CLOSE_H, - IDR_CLOSE_P, - IDR_CLOSE_BUTTON_MASK, - IDS_ACCNAME_CLOSE, - VIEW_ID_CLOSE_BUTTON); - } + minimize_button_ = InitWindowCaptionButton(IDR_MINIMIZE, + IDR_MINIMIZE_H, + IDR_MINIMIZE_P, + IDR_MINIMIZE_BUTTON_MASK, + IDS_ACCNAME_MINIMIZE, + VIEW_ID_MINIMIZE_BUTTON); + maximize_button_ = InitWindowCaptionButton(IDR_MAXIMIZE, + IDR_MAXIMIZE_H, + IDR_MAXIMIZE_P, + IDR_MAXIMIZE_BUTTON_MASK, + IDS_ACCNAME_MAXIMIZE, + VIEW_ID_MAXIMIZE_BUTTON); + restore_button_ = InitWindowCaptionButton(IDR_RESTORE, + IDR_RESTORE_H, + IDR_RESTORE_P, + IDR_RESTORE_BUTTON_MASK, + IDS_ACCNAME_RESTORE, + VIEW_ID_RESTORE_BUTTON); + close_button_ = InitWindowCaptionButton(IDR_CLOSE, + IDR_CLOSE_H, + IDR_CLOSE_P, + IDR_CLOSE_BUTTON_MASK, + IDS_ACCNAME_CLOSE, + VIEW_ID_CLOSE_BUTTON); // Initializing the TabIconView is expensive, so only do it if we need to. if (browser_view->ShouldShowWindowIcon()) { @@ -274,8 +272,6 @@ void OpaqueBrowserFrameView::GetWindowMask(const gfx::Size& size, } void OpaqueBrowserFrameView::ResetWindowControls() { - if (!OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons()) - return; restore_button_->SetState(views::CustomButton::STATE_NORMAL); minimize_button_->SetState(views::CustomButton::STATE_NORMAL); maximize_button_->SetState(views::CustomButton::STATE_NORMAL); @@ -472,8 +468,6 @@ gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const { } bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const { - if (!OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons()) - return false; return ShouldShowWindowTitleBar(); } diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc index ec84b5a..4847dfa 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc @@ -14,10 +14,6 @@ #include "ui/views/controls/button/image_button.h" #include "ui/views/controls/label.h" -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif // OS_WIN - namespace { // Besides the frame border, there's another 9 px of empty space atop the @@ -128,15 +124,6 @@ OpaqueBrowserFrameViewLayout::OpaqueBrowserFrameViewLayout( OpaqueBrowserFrameViewLayout::~OpaqueBrowserFrameViewLayout() {} -// static -bool OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons() { -#if defined(OS_WIN) - return !win8::IsSingleWindowMetroMode(); -#else - return true; -#endif -} - void OpaqueBrowserFrameViewLayout::SetButtonOrdering( const std::vector<views::FrameButton>& leading_buttons, const std::vector<views::FrameButton>& trailing_buttons) { @@ -292,9 +279,6 @@ int OpaqueBrowserFrameViewLayout::NewTabCaptionSpacing() const { } void OpaqueBrowserFrameViewLayout::LayoutWindowControls(views::View* host) { - if (!ShouldAddDefaultCaptionButtons()) - return; - int caption_y = CaptionButtonY(false); // Keep a list of all buttons that we don't show. diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index a7b95af..a663391 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -26,6 +26,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" @@ -38,37 +39,19 @@ #include "ui/views/window/client_view.h" #if defined(OS_WIN) +#include "chrome/browser/hang_monitor/hang_crash_dump_win.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/shell_integration.h" #include "ui/base/win/shell.h" #include "ui/views/win/hwnd_util.h" #endif -#if defined(USE_AURA) -#include "ui/aura/window.h" -#endif - #if defined(OS_WIN) #include "ui/base/win/shell.h" #endif using content::WebContents; -// These functions allow certain chrome platforms to override the default hung -// renderer dialog. For e.g. Chrome on Windows 8 metro -bool PlatformShowCustomHungRendererDialog(WebContents* contents); -bool PlatformHideCustomHungRendererDialog(WebContents* contents); - -#if !defined(OS_WIN) -bool PlatformShowCustomHungRendererDialog(WebContents* contents) { - return false; -} - -bool PlatformHideCustomHungRendererDialog(WebContents* contents) { - return false; -} -#endif // OS_WIN - HungRendererDialogView* HungRendererDialogView::g_instance_ = NULL; /////////////////////////////////////////////////////////////////////////////// @@ -218,13 +201,16 @@ bool HungRendererDialogView::IsFrameActive(WebContents* contents) { return platform_util::IsWindowActive(frame_view); } -#if !defined(OS_WIN) // static void HungRendererDialogView::KillRendererProcess( base::ProcessHandle process_handle) { +#if defined(OS_WIN) + // Try to generate a crash report for the hung process. + CrashDumpAndTerminateHungChildProcess(process_handle); +#else base::KillProcess(process_handle, content::RESULT_CODE_HUNG, false); +#endif } -#endif // OS_WIN HungRendererDialogView::HungRendererDialogView() @@ -451,27 +437,22 @@ void HungRendererDialogView::InitClass() { namespace chrome { void ShowHungRendererDialog(WebContents* contents) { - if (!logging::DialogsAreSuppressed() && - !PlatformShowCustomHungRendererDialog(contents)) { - gfx::NativeView toplevel_view = - platform_util::GetTopLevel(contents->GetView()->GetNativeView()); -#if defined(USE_AURA) - // Don't show the dialog if there is no root window for the renderer, - // because it's invisible to the user (happens when the renderer is for - // prerendering for example). - if (!toplevel_view->GetRootWindow()) - return; -#endif - HungRendererDialogView* view = HungRendererDialogView::Create( - toplevel_view); - view->ShowForWebContents(contents); - } + if (logging::DialogsAreSuppressed()) + return; + + gfx::NativeView toplevel_view = + platform_util::GetTopLevel(contents->GetView()->GetNativeView()); + // Don't show the dialog if there is no root window for the renderer, because + // it's invisible to the user (happens when the renderer is for prerendering + // for example). + if (!toplevel_view->GetRootWindow()) + return; + HungRendererDialogView* view = HungRendererDialogView::Create(toplevel_view); + view->ShowForWebContents(contents); } void HideHungRendererDialog(WebContents* contents) { - if (!logging::DialogsAreSuppressed() && - !PlatformHideCustomHungRendererDialog(contents) && - HungRendererDialogView::GetInstance()) + if (!logging::DialogsAreSuppressed() && HungRendererDialogView::GetInstance()) HungRendererDialogView::GetInstance()->EndForWebContents(contents); } diff --git a/chrome/browser/ui/views/hung_renderer_view_win.cc b/chrome/browser/ui/views/hung_renderer_view_win.cc deleted file mode 100644 index 992d964..0000000 --- a/chrome/browser/ui/views/hung_renderer_view_win.cc +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) 2012 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/ui/views/hung_renderer_view_win.h" - -#include "base/win/metro.h" -#include "chrome/browser/hang_monitor/hang_crash_dump_win.h" -#include "chrome/browser/ui/views/hung_renderer_view.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/render_process_host.h" -#include "grit/generated_resources.h" -#include "ui/base/l10n/l10n_util.h" -#include "win8/util/win8_util.h" - -// Metro functions for displaying and dismissing a dialog box. -typedef void (*MetroShowDialogBox)( - const wchar_t* title, - const wchar_t* content, - const wchar_t* button1_label, - const wchar_t* button2_label, - base::win::MetroDialogButtonPressedHandler button1_handler, - base::win::MetroDialogButtonPressedHandler button2_handler); - -typedef void (*MetroDismissDialogBox)(); - -using content::BrowserThread; -using content::WebContents; - -HungRendererDialogMetro* HungRendererDialogMetro::g_instance_ = NULL; - -bool PlatformShowCustomHungRendererDialog(WebContents* contents) { - if (!win8::IsSingleWindowMetroMode()) - return false; - - HungRendererDialogMetro::Create()->Show(contents); - return true; -} - -bool PlatformHideCustomHungRendererDialog(WebContents* contents) { - if (!win8::IsSingleWindowMetroMode()) - return false; - - if (HungRendererDialogMetro::GetInstance()) - HungRendererDialogMetro::GetInstance()->Hide(contents); - return true; -} - -// static -void HungRendererDialogView::KillRendererProcess( - base::ProcessHandle process_handle) { - // Try to generate a crash report for the hung process. - CrashDumpAndTerminateHungChildProcess(process_handle); -} - -// static -HungRendererDialogMetro* HungRendererDialogMetro::Create() { - if (!GetInstance()) - g_instance_ = new HungRendererDialogMetro; - return g_instance_; -} - -// static -HungRendererDialogMetro* HungRendererDialogMetro::GetInstance() { - return g_instance_; -} - -HungRendererDialogMetro::HungRendererDialogMetro() - : contents_(NULL), - metro_dialog_displayed_(false) { -} - -HungRendererDialogMetro::~HungRendererDialogMetro() { - g_instance_ = NULL; -} - -void HungRendererDialogMetro::Show(WebContents* contents) { - if (!metro_dialog_displayed_ && - HungRendererDialogView::IsFrameActive(contents)) { - HMODULE metro_dll = base::win::GetMetroModule(); - DCHECK(metro_dll); - if (metro_dll) { - MetroShowDialogBox show_dialog_box = reinterpret_cast<MetroShowDialogBox> - (::GetProcAddress(metro_dll, "ShowDialogBox")); - DCHECK(show_dialog_box); - if (show_dialog_box) { - base::string16 dialog_box_title = - l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_TITLE); - - base::string16 kill_button_label = - l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_END); - - base::string16 wait_button_label = - l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT); - - contents_ = contents; - metro_dialog_displayed_ = true; - - (*show_dialog_box)(dialog_box_title.c_str(), - contents->GetTitle().c_str(), - kill_button_label.c_str(), - wait_button_label.c_str(), - HungRendererDialogMetro::OnMetroKillProcess, - HungRendererDialogMetro::OnMetroWait); - } - } - } -} - -void HungRendererDialogMetro::Hide(WebContents* contents) { - HMODULE metro_dll = base::win::GetMetroModule(); - DCHECK(metro_dll); - if (metro_dll) { - MetroDismissDialogBox dismiss_dialog_box = - reinterpret_cast<MetroDismissDialogBox> - (::GetProcAddress(metro_dll, "DismissDialogBox")); - DCHECK(dismiss_dialog_box); - if (dismiss_dialog_box) { - (*dismiss_dialog_box)(); - ResetMetroState(); - } - } -} - -void HungRendererDialogMetro::ResetMetroState() { - metro_dialog_displayed_ = false; - contents_ = NULL; - delete g_instance_; -} - -// static -void HungRendererDialogMetro::OnMetroKillProcess() { - // Metro chrome will invoke these handlers on the metro thread. Ensure that - // we switch to the UI thread. - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(HungRendererDialogMetro::OnMetroKillProcess)); - return; - } - - // Its possible that we got deleted in the meantime. - if (!GetInstance()) - return; - - DCHECK(GetInstance()->contents_); - - HungRendererDialogView::KillRendererProcess( - GetInstance()->contents_->GetRenderProcessHost()->GetHandle()); - - // The metro dialog box is dismissed when the button handlers are invoked. - GetInstance()->ResetMetroState(); -} - -// static -void HungRendererDialogMetro::OnMetroWait() { - // Metro chrome will invoke these handlers on the metro thread. Ensure that - // we switch to the UI thread. - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(HungRendererDialogMetro::OnMetroWait)); - return; - } - - // Its possible that we got deleted in the meantime. - if (!GetInstance()) - return; - - GetInstance()->ResetMetroState(); -} diff --git a/chrome/browser/ui/views/hung_renderer_view_win.h b/chrome/browser/ui/views/hung_renderer_view_win.h deleted file mode 100644 index 3920c40..0000000 --- a/chrome/browser/ui/views/hung_renderer_view_win.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2012 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_UI_VIEWS_HUNG_RENDERER_VIEW_WIN_H_ -#define CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_WIN_H_ - -#include "base/basictypes.h" -#include "content/public/browser/web_contents.h" - -// This class provides functionality to display a Windows 8 metro style hung -// renderer dialog. -class HungRendererDialogMetro { - public: - // Creates or returns the global instance of the HungRendererDialogMetro - // class - static HungRendererDialogMetro* Create(); - static HungRendererDialogMetro* GetInstance(); - - void Show(content::WebContents* contents); - void Hide(content::WebContents* contents); - - private: - HungRendererDialogMetro(); - ~HungRendererDialogMetro(); - - // Handlers for the hang monitor dialog displayed in Windows 8 metro. - static void OnMetroKillProcess(); - static void OnMetroWait(); - - // Resets Windows 8 metro specific state like whether the dialog was - // displayed, etc. - void ResetMetroState(); - - content::WebContents* contents_; - - // Set to true if the metro version of the hang dialog is displayed. - // Helps ensure that only one instance of the dialog is displayed at any - // given time. - bool metro_dialog_displayed_; - - // Pointer to the global instance of the HungRendererDialogMetro class. - static HungRendererDialogMetro* g_instance_; - - DISALLOW_COPY_AND_ASSIGN(HungRendererDialogMetro); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_HUNG_RENDERER_VIEW_WIN_H_ - diff --git a/chrome/browser/ui/views/profiles/user_manager_view.cc b/chrome/browser/ui/views/profiles/user_manager_view.cc index 5d305a7..c0eb030 100644 --- a/chrome/browser/ui/views/profiles/user_manager_view.cc +++ b/chrome/browser/ui/views/profiles/user_manager_view.cc @@ -30,7 +30,6 @@ #include "chrome/browser/shell_integration.h" #include "ui/base/win/shell.h" #include "ui/views/win/hwnd_util.h" -#include "win8/util/win8_util.h" #endif namespace { diff --git a/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.cc b/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.cc index 3ef9aa5..20edad9 100644 --- a/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.cc +++ b/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.cc @@ -19,7 +19,6 @@ #include "ui/views/controls/menu/menu_item_view.h" #include "ui/views/controls/menu/menu_runner.h" - using content::WebContents; //////////////////////////////////////////////////////////////////////////////// @@ -35,14 +34,12 @@ RenderViewContextMenuViews::RenderViewContextMenuViews( RenderViewContextMenuViews::~RenderViewContextMenuViews() { } -#if !defined(OS_WIN) // static RenderViewContextMenuViews* RenderViewContextMenuViews::Create( content::RenderFrameHost* render_frame_host, const content::ContextMenuParams& params) { return new RenderViewContextMenuViews(render_frame_host, params); } -#endif // OS_WIN void RenderViewContextMenuViews::RunMenuAt(views::Widget* parent, const gfx::Point& point, diff --git a/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_win.cc b/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_win.cc deleted file mode 100644 index a470587..0000000 --- a/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_win.cc +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2014 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/ui/views/renderer_context_menu/render_view_context_menu_win.h" - -#include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/tab_contents/retargeting_details.h" -#include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "content/public/browser/web_contents.h" -#include "win8/util/win8_util.h" - -using content::WebContents; - -RenderViewContextMenuWin::RenderViewContextMenuWin( - content::RenderFrameHost* render_frame_host, - const content::ContextMenuParams& params) - : RenderViewContextMenuViews(render_frame_host, params) { -} - -RenderViewContextMenuWin::~RenderViewContextMenuWin() { -} - -// static -RenderViewContextMenuViews* RenderViewContextMenuViews::Create( - content::RenderFrameHost* render_frame_host, - const content::ContextMenuParams& params) { - return new RenderViewContextMenuWin(render_frame_host, params); -} - -bool RenderViewContextMenuWin::IsCommandIdVisible(int command_id) const { - // In windows 8 metro mode no new window option on normal browser windows. - if (win8::IsSingleWindowMetroMode() && !profile_->IsOffTheRecord() && - command_id == IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW) { - return false; - } - return RenderViewContextMenu::IsCommandIdVisible(command_id); -} - -void RenderViewContextMenuWin::ExecuteCommand(int command_id, - int event_flags) { - if (win8::IsSingleWindowMetroMode() && - command_id == IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW) { - // The open link in new window command should only be enabled for - // incognito windows in metro mode. - DCHECK(profile_->IsOffTheRecord()); - // We directly go to the Browser object to open the url in effect - // bypassing the delegate. Currently the Browser is the only class which - // implements the delegate for the context menu. This would break if there - // are other delegates for the context menu. This is ok for now as this - // code only executes for Windows 8 metro mode. - // TODO(robertshield): FTB - Switch this to HOST_DESKTOP_TYPE_ASH when - // we make that the default for metro. - Browser* browser = - chrome::FindTabbedBrowser(profile_->GetOriginalProfile(), - false, - chrome::HOST_DESKTOP_TYPE_NATIVE); - if (browser) { - content::OpenURLParams url_params( - params_.link_url, - content::Referrer(params_.frame_url.is_empty() ? - params_.page_url : params_.frame_url, - params_.referrer_policy), - NEW_FOREGROUND_TAB, - content::PAGE_TRANSITION_LINK, - false); - WebContents* source_web_contents = - browser->tab_strip_model()->GetActiveWebContents(); - WebContents* new_contents = source_web_contents->OpenURL(url_params); - DCHECK(new_contents); - return; - } - } - RenderViewContextMenu::ExecuteCommand(command_id, event_flags); -} diff --git a/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_win.h b/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_win.h deleted file mode 100644 index 12d6b34..0000000 --- a/chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_win.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 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_UI_VIEWS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_WIN_H_ -#define CHROME_BROWSER_UI_VIEWS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_WIN_H_ - -#include "chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.h" - -namespace content { -class WebContents; -} - -// Windows specific implementation of the render view context menu. -class RenderViewContextMenuWin : public RenderViewContextMenuViews { - public: - RenderViewContextMenuWin(content::RenderFrameHost* render_frame_host, - const content::ContextMenuParams& params); - virtual ~RenderViewContextMenuWin(); - - // SimpleMenuModel::Delegate implementation. - virtual bool IsCommandIdVisible(int command_id) const OVERRIDE; - virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuWin); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_WIN_H_ diff --git a/chrome/browser/ui/views/status_icons/status_icon_win.cc b/chrome/browser/ui/views/status_icons/status_icon_win.cc index 9dd5997..2bbbdae 100644 --- a/chrome/browser/ui/views/status_icons/status_icon_win.cc +++ b/chrome/browser/ui/views/status_icons/status_icon_win.cc @@ -5,14 +5,12 @@ #include "chrome/browser/ui/views/status_icons/status_icon_win.h" #include "base/strings/string_number_conversions.h" -#include "base/win/metro.h" #include "base/win/windows_version.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/icon_util.h" #include "ui/gfx/point.h" #include "ui/views/controls/menu/menu_item_view.h" #include "ui/views/controls/menu/menu_runner.h" -#include "win8/util/win8_util.h" //////////////////////////////////////////////////////////////////////////////// // StatusIconWin, public: @@ -167,51 +165,3 @@ void StatusIconWin::InitIconData(NOTIFYICONDATA* icon_data) { icon_data->hWnd = window_; icon_data->uID = icon_id_; } - -//////////////////////////////////////////////////////////////////////////////// -// StatusIconMetro - -StatusIconMetro::StatusIconMetro(UINT id) - : id_(id) { - DCHECK(win8::IsSingleWindowMetroMode()); -} - -StatusIconMetro::~StatusIconMetro() { -} - -void StatusIconMetro::SetImage(const gfx::ImageSkia& image) { - DVLOG(1) << __FUNCTION__; -} - -void StatusIconMetro::SetPressedImage(const gfx::ImageSkia& image) { - DVLOG(1) << __FUNCTION__; -} - -void StatusIconMetro::SetToolTip(const base::string16& tool_tip) { - DVLOG(1) << __FUNCTION__; - tool_tip_ = tool_tip; -} - -void StatusIconMetro::DisplayBalloon(const gfx::ImageSkia& icon, - const base::string16& title, - const base::string16& contents) { - DVLOG(1) << __FUNCTION__; - - HMODULE metro_module = base::win::GetMetroModule(); - DCHECK(metro_module); - - if (metro_module) { - base::win::MetroNotification notification = - reinterpret_cast<base::win::MetroNotification>( - ::GetProcAddress(metro_module, "DisplayNotification")); - DCHECK(notification); - notification("", "", title.c_str(), contents.c_str(), L"", - base::IntToString(id_).c_str(), NULL, NULL); - } -} - -void StatusIconMetro::UpdatePlatformContextMenu(StatusIconMenuModel* menu) { - DVLOG(1) << __FUNCTION__ - << " This functionality is not supported in Windows 8 metro"; -} - diff --git a/chrome/browser/ui/views/status_icons/status_icon_win.h b/chrome/browser/ui/views/status_icons/status_icon_win.h index c8e5953..f6d5bb9 100644 --- a/chrome/browser/ui/views/status_icons/status_icon_win.h +++ b/chrome/browser/ui/views/status_icons/status_icon_win.h @@ -82,29 +82,4 @@ class StatusIconWin : public StatusIcon { DISALLOW_COPY_AND_ASSIGN(StatusIconWin); }; -// Implements status notifications using Windows 8 metro style notifications. -class StatusIconMetro : public StatusIcon { - public: - // Constructor which provides this icon's unique ID and messaging window. - explicit StatusIconMetro(UINT id); - virtual ~StatusIconMetro(); - - // Overridden from StatusIcon: - virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE; - virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE; - virtual void SetToolTip(const base::string16& tool_tip) OVERRIDE; - virtual void DisplayBalloon(const gfx::ImageSkia& icon, - const base::string16& title, - const base::string16& contents) OVERRIDE; - protected: - virtual void UpdatePlatformContextMenu( - StatusIconMenuModel* menu) OVERRIDE; - - private: - base::string16 tool_tip_; - const UINT id_; - - DISALLOW_COPY_AND_ASSIGN(StatusIconMetro); -}; - #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_ diff --git a/chrome/browser/ui/views/status_icons/status_tray_win.cc b/chrome/browser/ui/views/status_icons/status_tray_win.cc index 8c66cd42..bcbe8e6 100644 --- a/chrome/browser/ui/views/status_icons/status_tray_win.cc +++ b/chrome/browser/ui/views/status_icons/status_tray_win.cc @@ -11,7 +11,6 @@ #include "chrome/common/chrome_constants.h" #include "ui/gfx/screen.h" #include "ui/gfx/win/hwnd_util.h" -#include "win8/util/win8_util.h" static const UINT kStatusIconMessage = WM_APP + 1; @@ -135,11 +134,8 @@ StatusIcon* StatusTrayWin::CreatePlatformStatusIcon( else next_icon_id = ReservedIconId(type); - StatusIcon* icon = NULL; - if (win8::IsSingleWindowMetroMode()) - icon = new StatusIconMetro(next_icon_id); - else - icon = new StatusIconWin(next_icon_id, window_, kStatusIconMessage); + StatusIcon* icon = + new StatusIconWin(next_icon_id, window_, kStatusIconMessage); icon->SetImage(image); icon->SetToolTip(tool_tip); diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index 3c0b397..3326c9e 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -49,10 +49,6 @@ #include "ui/views/widget/widget.h" #include "ui/views/window/non_client_view.h" -#if defined(OS_WIN) -#include "win8/util/win8_util.h" -#endif - #if defined(USE_ASH) #include "ui/aura/env.h" #endif @@ -1681,11 +1677,6 @@ void Tab::GetTabIdAndFrameId(views::Widget* widget, } else if (data().incognito) { *tab_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; *frame_id = IDR_THEME_FRAME_INCOGNITO; -#if defined(OS_WIN) - } else if (win8::IsSingleWindowMetroMode()) { - *tab_id = IDR_THEME_TAB_BACKGROUND_V; - *frame_id = 0; -#endif } else { *tab_id = IDR_THEME_TAB_BACKGROUND; *frame_id = IDR_THEME_FRAME; diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index de351f5..0904445 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -59,7 +59,6 @@ #include "ui/gfx/win/hwnd_util.h" #include "ui/views/widget/monitor_win.h" #include "ui/views/win/hwnd_util.h" -#include "win8/util/win8_util.h" #endif using base::UserMetricsAction; @@ -440,10 +439,6 @@ gfx::ImageSkia NewTabButton::GetBackgroundImage( background_id = IDR_THEME_TAB_BACKGROUND_V; } else if (tab_strip_->controller()->IsIncognito()) { background_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; -#if defined(OS_WIN) - } else if (win8::IsSingleWindowMetroMode()) { - background_id = IDR_THEME_TAB_BACKGROUND_V; -#endif } else { background_id = IDR_THEME_TAB_BACKGROUND; } @@ -1141,11 +1136,6 @@ void TabStrip::MaybeStartDrag( move_behavior = TabDragController::MOVE_VISIBILE_TABS; } -#if defined(OS_WIN) - // It doesn't make sense to drag tabs out on Win8's single window Metro mode. - if (win8::IsSingleWindowMetroMode()) - detach_behavior = TabDragController::NOT_DETACHABLE; -#endif drag_controller_.reset(new TabDragController); drag_controller_->Init( this, tab, tabs, gfx::Point(x, y), event.x(), selection_model, diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc index 796a18c..0216996 100644 --- a/chrome/browser/ui/views/task_manager_view.cc +++ b/chrome/browser/ui/views/task_manager_view.cc @@ -50,7 +50,6 @@ #include "chrome/browser/shell_integration.h" #include "ui/base/win/shell.h" #include "ui/views/win/hwnd_util.h" -#include "win8/util/win8_util.h" #endif namespace { @@ -461,10 +460,6 @@ bool TaskManagerView::AcceleratorPressed(const ui::Accelerator& accelerator) { // static void TaskManagerView::Show(Browser* browser) { -#if defined(OS_WIN) - // In Windows Metro it's not good to open this native window. - DCHECK(!win8::IsSingleWindowMetroMode()); -#endif // In ash we can come here through the ChromeShellDelegate. If there is no // browser window at that time of the call, browser could be passed as NULL. const chrome::HostDesktopType desktop_type = diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 922635e..3344cc2 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1361,7 +1361,6 @@ 'browser/notifications/desktop_notification_service.h', 'browser/notifications/desktop_notification_service_factory.cc', 'browser/notifications/desktop_notification_service_factory.h', - 'browser/notifications/desktop_notification_service_win.cc', 'browser/notifications/extension_welcome_notification.cc', 'browser/notifications/extension_welcome_notification.h', 'browser/notifications/message_center_notification_manager.cc', @@ -3347,7 +3346,6 @@ '../third_party/isimpledom/isimpledom.gyp:isimpledom', '../ui/views/controls/webview/webview.gyp:webview', '../ui/views/views.gyp:views', - '../win8/win8.gyp:win8_util', ], 'export_dependent_settings': [ '../ui/views/controls/webview/webview.gyp:webview', diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index b3bd98f..47a8836a 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -1325,8 +1325,6 @@ 'browser/ui/startup/startup_browser_creator.h', 'browser/ui/startup/startup_browser_creator_impl.cc', 'browser/ui/startup/startup_browser_creator_impl.h', - 'browser/ui/startup/startup_browser_creator_win.cc', - 'browser/ui/startup/startup_browser_creator_win.h', 'browser/ui/startup/startup_tab.cc', 'browser/ui/startup/startup_tab.h', 'browser/ui/startup/startup_types.h', @@ -1502,7 +1500,6 @@ 'browser/ui/views/bookmarks/bookmark_bubble_view_observer.h', 'browser/ui/views/bookmarks/bookmark_context_menu.cc', 'browser/ui/views/bookmarks/bookmark_context_menu.h', - 'browser/ui/views/bookmarks/bookmark_context_menu_controller_win.cc', 'browser/ui/views/bookmarks/bookmark_drag_drop_views.cc', 'browser/ui/views/bookmarks/bookmark_drag_drop_views.h', 'browser/ui/views/bookmarks/bookmark_editor_view.cc', @@ -1711,8 +1708,6 @@ 'browser/ui/views/global_error_bubble_view.h', 'browser/ui/views/hung_renderer_view.cc', 'browser/ui/views/hung_renderer_view.h', - 'browser/ui/views/hung_renderer_view_win.cc', - 'browser/ui/views/hung_renderer_view_win.h', 'browser/ui/views/importer/import_lock_dialog_view.cc', 'browser/ui/views/importer/import_lock_dialog_view.h', 'browser/ui/views/infobars/alternate_nav_infobar_view.cc', @@ -1839,8 +1834,6 @@ 'browser/ui/views/profiles/user_manager_view.h', 'browser/ui/views/renderer_context_menu/render_view_context_menu_views.cc', 'browser/ui/views/renderer_context_menu/render_view_context_menu_views.h', - 'browser/ui/views/renderer_context_menu/render_view_context_menu_win.cc', - 'browser/ui/views/renderer_context_menu/render_view_context_menu_win.h', 'browser/ui/views/sad_tab_view.cc', 'browser/ui/views/sad_tab_view.h', 'browser/ui/views/screen_capture_notification_ui_views.cc', @@ -2984,7 +2977,6 @@ '../ui/app_list/app_list.gyp:app_list', '../ui/views/controls/webview/webview.gyp:webview', '../ui/views/views.gyp:views', - '../win8/win8.gyp:win8_util', ], 'export_dependent_settings': [ '../ui/views/controls/webview/webview.gyp:webview', diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 9473fbf..a48c496 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -1495,7 +1495,6 @@ # For accessibility '../third_party/iaccessible2/iaccessible2.gyp:iaccessible2', '../third_party/isimpledom/isimpledom.gyp:isimpledom', - '../win8/win8.gyp:win8_util', ], 'sources/': [ ['exclude', '^browser/device_orientation/data_fetcher_shared_memory_default.cc$'], diff --git a/win8/util/win8_util.cc b/win8/util/win8_util.cc deleted file mode 100644 index b630b8f..0000000 --- a/win8/util/win8_util.cc +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2012 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 "win8/util/win8_util.h" - -#include "base/win/metro.h" - -namespace win8 { - -bool IsSingleWindowMetroMode() { -#if defined(USE_ASH) - return false; -#else - return base::win::IsMetroProcess(); -#endif -} - -} // namespace win8 diff --git a/win8/util/win8_util.h b/win8/util/win8_util.h deleted file mode 100644 index 25d6ec0..0000000 --- a/win8/util/win8_util.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2012 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 WIN8_UTIL_WIN8_UTIL_H_ -#define WIN8_UTIL_WIN8_UTIL_H_ - -namespace win8 { - -// Returns true if this process is running in fullscreen Metro mode on Win8+. -// Callers should always prefer this method to base::win::IsMetroProcess() for -// UI properties dependent on the single window mode as this method is also -// aware of the Ash environment in which multiple Chrome windows can live. -bool IsSingleWindowMetroMode(); - -} // namespace win8 - -#endif // WIN8_UTIL_WIN8_UTIL_H_ diff --git a/win8/win8.gyp b/win8/win8.gyp index a20509c..e4f45c2 100644 --- a/win8/win8.gyp +++ b/win8/win8.gyp @@ -10,17 +10,6 @@ ], 'targets': [ { - 'target_name': 'win8_util', - 'type': 'static_library', - 'dependencies': [ - '../base/base.gyp:base', - ], - 'sources': [ - 'util/win8_util.cc', - 'util/win8_util.h', - ], - }, - { 'target_name': 'metro_viewer_constants', 'type': 'static_library', 'include_dirs': [ |