diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-12 22:18:48 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-12 22:18:48 +0000 |
commit | c5dd54b0b5960408f334c540914c138f1a8a7e57 (patch) | |
tree | d3b277eb1104a4fae89b2991714f218e101f6d9f /chrome | |
parent | a89cb41eabfd554da054483fd3f7acd70b8c41e1 (diff) | |
download | chromium_src-c5dd54b0b5960408f334c540914c138f1a8a7e57.zip chromium_src-c5dd54b0b5960408f334c540914c138f1a8a7e57.tar.gz chromium_src-c5dd54b0b5960408f334c540914c138f1a8a7e57.tar.bz2 |
linux_aura: Compile ash into chrome.
Running chrome with the "--open-ash" parameter will create an ash
desktop window. Ash on Linux has some problems, but at least we're now
compiling the code into the binary.
TODO: The applist isn't positioned correctly, and some details of the
system tray aren't correct.
BUG=300084, 303862
R=sky@chromium.org
Review URL: https://codereview.chromium.org/25108005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
37 files changed, 327 insertions, 171 deletions
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index cb0e1ef..088f3fca 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -164,8 +164,8 @@ </if> <if expr="use_ash"> <structure type="chrome_scaled_image" name="IDR_CONTENT_TOP_CENTER" file="common/ash/content_top_center.png" /> - <if expr="is_win"> - <structure type="chrome_scaled_image" name="IDR_CONTENT_TOP_CENTER_WIN" file="content_top_center.png" /> + <if expr="not chromeos"> + <structure type="chrome_scaled_image" name="IDR_CONTENT_TOP_CENTER_DESKTOP" file="content_top_center.png" /> </if> </if> <structure type="chrome_scaled_image" name="IDR_CONTENT_TOP_LEFT_CORNER" file="content_top_left_corner.png" /> @@ -661,8 +661,8 @@ </if> <if expr="use_ash"> <structure type="chrome_scaled_image" name="IDR_OTR_ICON" file="common/ash/otr_icon.png" /> - <if expr="is_win"> - <structure type="chrome_scaled_image" name="IDR_OTR_ICON_WIN" file="common/otr_icon.png" /> + <if expr="not chromeos"> + <structure type="chrome_scaled_image" name="IDR_OTR_ICON_DESKTOP" file="common/otr_icon.png" /> </if> </if> </if> @@ -1188,11 +1188,11 @@ <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INACTIVE" file="common/ash/theme_frame_inactive.png" /> <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO" file="common/ash/theme_frame_incognito_active.png" /> <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="common/ash/theme_frame_incognito_inactive.png" /> - <if expr="is_win"> - <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_WIN" file="theme_frame.png" /> - <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INACTIVE_WIN" file="theme_frame_inactive.png" /> - <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO_WIN" file="theme_frame_incognito.png" /> - <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO_INACTIVE_WIN" file="theme_frame_incognito_inactive.png" /> + <if expr="not chromeos"> + <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_DESKTOP" file="theme_frame.png" /> + <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INACTIVE_DESKTOP" file="theme_frame_inactive.png" /> + <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO_DESKTOP" file="theme_frame_incognito.png" /> + <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_INCOGNITO_INACTIVE_DESKTOP" file="theme_frame_incognito_inactive.png" /> </if> </if> <structure type="chrome_scaled_image" name="IDR_THEME_FRAME_OVERLAY" file="notused.png" /> @@ -1207,9 +1207,9 @@ <!-- Ash has gray tab backgrounds, Windows uses blue. --> <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND" file="common/ash/theme_default_inactive.png" /> <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO" file="common/ash/theme_default_inactive.png" /> - <if expr="is_win"> - <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_WIN" file="theme_tab_background.png" /> - <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO_WIN" file="theme_tab_background_incognito.png" /> + <if expr="not chromeos"> + <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_DESKTOP" file="theme_tab_background.png" /> + <structure type="chrome_scaled_image" name="IDR_THEME_TAB_BACKGROUND_INCOGNITO_DESKTOP" file="theme_tab_background_incognito.png" /> </if> </if> <if expr="is_macosx or is_ios"> @@ -1223,8 +1223,8 @@ <if expr="use_ash"> <!-- Ash has a dark gray toolbar background, Windows has light gray. --> <structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR" file="common/ash/theme_default_active.png" /> - <if expr="is_win"> - <structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR_WIN" file="theme_toolbar_default.png" /> + <if expr="not chromeos"> + <structure type="chrome_scaled_image" name="IDR_THEME_TOOLBAR_DESKTOP" file="theme_toolbar_default.png" /> </if> </if> <if expr="is_macosx or is_ios"> diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc index b50247a..90bfdae 100644 --- a/chrome/browser/extensions/window_open_apitest.cc +++ b/chrome/browser/extensions/window_open_apitest.cc @@ -35,7 +35,7 @@ #include "apps/app_window_registry.h" #endif -#if defined(USE_ASH) && !defined(OS_WIN) +#if defined(USE_ASH) && defined(OS_CHROMEOS) // TODO(stevenjb): Figure out the correct behavior for Ash + Win #define USE_ASH_PANELS #endif @@ -273,8 +273,16 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, MAYBE_WindowOpenPanelDetached) { ASSERT_TRUE(RunExtensionTest("window_open/panel_detached")) << message_; } +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +// TODO(erg): Bring up ash http://crbug.com/300084 +#define MAYBE_CloseNonExtensionPanelsOnUninstall \ + DISABLED_CloseNonExtensionPanelsOnUninstall +#else +#define MAYBE_CloseNonExtensionPanelsOnUninstall \ + CloseNonExtensionPanelsOnUninstall +#endif IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, - CloseNonExtensionPanelsOnUninstall) { + MAYBE_CloseNonExtensionPanelsOnUninstall) { #if defined(OS_WIN) && defined(USE_ASH) // Disable this test in Metro+Ash for now (http://crbug.com/262796). if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) @@ -345,8 +353,8 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, EXPECT_TRUE(WaitForTabsAndPopups(browser(), 1, num_popups, 0)); } -// This test isn't applicable on Chrome OS, which automatically reloads -// crashed pages. +// This test isn't applicable on Chrome OS, which automatically reloads crashed +// pages. #if !defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, ClosePanelsOnExtensionCrash) { #if defined(USE_ASH_PANELS) diff --git a/chrome/browser/fullscreen_aurax11.cc b/chrome/browser/fullscreen_aurax11.cc index b186c00..eca8c22 100644 --- a/chrome/browser/fullscreen_aurax11.cc +++ b/chrome/browser/fullscreen_aurax11.cc @@ -6,11 +6,21 @@ #include <vector> +#include "ash/root_window_controller.h" +#include "chrome/browser/ui/host_desktop.h" #include "ui/gfx/native_widget_types.h" #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" #include "ui/views/widget/widget.h" bool IsFullScreenMode() { +#if defined(USE_ASH) + if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) { + ash::RootWindowController* controller = + ash::RootWindowController::ForTargetRootWindow(); + return controller && controller->GetWindowForFullscreenMode(); + } +#endif + std::vector<aura::Window*> all_windows = views::DesktopWindowTreeHostX11::GetAllOpenWindows(); // Only the topmost window is checked. This works fine in the most cases, but diff --git a/chrome/browser/managed_mode/managed_user_theme.cc b/chrome/browser/managed_mode/managed_user_theme.cc index f2055a2..6431728 100644 --- a/chrome/browser/managed_mode/managed_user_theme.cc +++ b/chrome/browser/managed_mode/managed_user_theme.cc @@ -21,19 +21,19 @@ const SkColor kDefaultColorManagedUserLabelBackground = int MapToManagedUserResourceIds(int id) { switch (id) { case IDR_THEME_FRAME: -#if defined(OS_WIN) - case IDR_THEME_FRAME_WIN: +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + case IDR_THEME_FRAME_DESKTOP: #endif return IDR_MANAGED_USER_THEME_FRAME; case IDR_THEME_FRAME_INACTIVE: -#if defined(OS_WIN) - case IDR_THEME_FRAME_INACTIVE_WIN: +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + case IDR_THEME_FRAME_INACTIVE_DESKTOP: #endif return IDR_MANAGED_USER_THEME_FRAME_INACTIVE; case IDR_THEME_TAB_BACKGROUND: case IDR_THEME_TAB_BACKGROUND_V: -#if defined(OS_WIN) - case IDR_THEME_TAB_BACKGROUND_WIN: +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + case IDR_THEME_TAB_BACKGROUND_DESKTOP: #endif return IDR_MANAGED_USER_THEME_TAB_BACKGROUND; } diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc index c06040a..7855ae6 100644 --- a/chrome/browser/notifications/message_center_notification_manager.cc +++ b/chrome/browser/notifications/message_center_notification_manager.cc @@ -78,7 +78,7 @@ MessageCenterNotificationManager::MessageCenterNotificationManager( blockers_.push_back(new FullscreenNotificationBlocker(message_center)); #if defined(OS_WIN) || defined(OS_MACOSX) \ - || (defined(USE_AURA) && !defined(USE_ASH)) + || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) // On Windows, Linux and Mac, the notification manager owns the tray icon and // views.Other platforms have global ownership and Create will return NULL. tray_.reset(message_center::CreateMessageCenterTray()); diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index d209599..6a27182 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -43,7 +43,7 @@ namespace { // Version number of the current theme pack. We just throw out and rebuild // theme packs that aren't int-equal to this. Increment this number if you // change default theme assets. -const int kThemePackVersion = 33; +const int kThemePackVersion = 34; // IDs that are in the DataPack won't clash with the positive integer // uint16. kHeaderID should always have the maximum value because we want the @@ -162,37 +162,37 @@ PersistingImagesTable kPersistingImages[] = { }; const size_t kPersistingImagesLength = arraysize(kPersistingImages); -#if defined(OS_WIN) +#if defined(USE_ASH) && !defined(OS_CHROMEOS) // Persistent theme ids for Windows. -const int PRS_THEME_FRAME_WIN = 100; -const int PRS_THEME_FRAME_INACTIVE_WIN = 101; -const int PRS_THEME_FRAME_INCOGNITO_WIN = 102; -const int PRS_THEME_FRAME_INCOGNITO_INACTIVE_WIN = 103; -const int PRS_THEME_TOOLBAR_WIN = 104; -const int PRS_THEME_TAB_BACKGROUND_WIN = 105; -const int PRS_THEME_TAB_BACKGROUND_INCOGNITO_WIN = 106; +const int PRS_THEME_FRAME_DESKTOP = 100; +const int PRS_THEME_FRAME_INACTIVE_DESKTOP = 101; +const int PRS_THEME_FRAME_INCOGNITO_DESKTOP = 102; +const int PRS_THEME_FRAME_INCOGNITO_INACTIVE_DESKTOP = 103; +const int PRS_THEME_TOOLBAR_DESKTOP = 104; +const int PRS_THEME_TAB_BACKGROUND_DESKTOP = 105; +const int PRS_THEME_TAB_BACKGROUND_INCOGNITO_DESKTOP = 106; // Persistent theme to resource id mapping for Windows AURA. -PersistingImagesTable kPersistingImagesWinDesktopAura[] = { - { PRS_THEME_FRAME_WIN, IDR_THEME_FRAME_WIN, +PersistingImagesTable kPersistingImagesDesktopAura[] = { + { PRS_THEME_FRAME_DESKTOP, IDR_THEME_FRAME_DESKTOP, "theme_frame" }, - { PRS_THEME_FRAME_INACTIVE_WIN, IDR_THEME_FRAME_INACTIVE_WIN, + { PRS_THEME_FRAME_INACTIVE_DESKTOP, IDR_THEME_FRAME_INACTIVE_DESKTOP, "theme_frame_inactive" }, - { PRS_THEME_FRAME_INCOGNITO_WIN, IDR_THEME_FRAME_INCOGNITO_WIN, + { PRS_THEME_FRAME_INCOGNITO_DESKTOP, IDR_THEME_FRAME_INCOGNITO_DESKTOP, "theme_frame_incognito" }, - { PRS_THEME_FRAME_INCOGNITO_INACTIVE_WIN, - IDR_THEME_FRAME_INCOGNITO_INACTIVE_WIN, + { PRS_THEME_FRAME_INCOGNITO_INACTIVE_DESKTOP, + IDR_THEME_FRAME_INCOGNITO_INACTIVE_DESKTOP, "theme_frame_incognito_inactive" }, - { PRS_THEME_TOOLBAR_WIN, IDR_THEME_TOOLBAR_WIN, + { PRS_THEME_TOOLBAR_DESKTOP, IDR_THEME_TOOLBAR_DESKTOP, "theme_toolbar" }, - { PRS_THEME_TAB_BACKGROUND_WIN, IDR_THEME_TAB_BACKGROUND_WIN, + { PRS_THEME_TAB_BACKGROUND_DESKTOP, IDR_THEME_TAB_BACKGROUND_DESKTOP, "theme_tab_background" }, - { PRS_THEME_TAB_BACKGROUND_INCOGNITO_WIN, - IDR_THEME_TAB_BACKGROUND_INCOGNITO_WIN, + { PRS_THEME_TAB_BACKGROUND_INCOGNITO_DESKTOP, + IDR_THEME_TAB_BACKGROUND_INCOGNITO_DESKTOP, "theme_tab_background_incognito" }, }; -const size_t kPersistingImagesWinDesktopAuraLength = - arraysize(kPersistingImagesWinDesktopAura); +const size_t kPersistingImagesDesktopAuraLength = + arraysize(kPersistingImagesDesktopAura); #endif int GetPersistentIDByNameHelper(const std::string& key, @@ -221,10 +221,10 @@ int GetPersistentIDByIDR(int idr) { int prs_id = kPersistingImages[i].persistent_id; (*lookup_table)[idr] = prs_id; } -#if defined(OS_WIN) - for (size_t i = 0; i < kPersistingImagesWinDesktopAuraLength; ++i) { - int idr = kPersistingImagesWinDesktopAura[i].idr_id; - int prs_id = kPersistingImagesWinDesktopAura[i].persistent_id; +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + for (size_t i = 0; i < kPersistingImagesDesktopAuraLength; ++i) { + int idr = kPersistingImagesDesktopAura[i].idr_id; + int prs_id = kPersistingImagesDesktopAura[i].persistent_id; (*lookup_table)[idr] = prs_id; } #endif @@ -341,11 +341,11 @@ IntToIntTable kFrameTintMap[] = { { PRS_THEME_FRAME_INCOGNITO, ThemeProperties::TINT_FRAME_INCOGNITO }, { PRS_THEME_FRAME_INCOGNITO_INACTIVE, ThemeProperties::TINT_FRAME_INCOGNITO_INACTIVE }, -#if defined(OS_WIN) - { PRS_THEME_FRAME_WIN, ThemeProperties::TINT_FRAME }, - { PRS_THEME_FRAME_INACTIVE_WIN, ThemeProperties::TINT_FRAME_INACTIVE }, - { PRS_THEME_FRAME_INCOGNITO_WIN, ThemeProperties::TINT_FRAME_INCOGNITO }, - { PRS_THEME_FRAME_INCOGNITO_INACTIVE_WIN, +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + { PRS_THEME_FRAME_DESKTOP, ThemeProperties::TINT_FRAME }, + { PRS_THEME_FRAME_INACTIVE_DESKTOP, ThemeProperties::TINT_FRAME_INACTIVE }, + { PRS_THEME_FRAME_INCOGNITO_DESKTOP, ThemeProperties::TINT_FRAME_INCOGNITO }, + { PRS_THEME_FRAME_INCOGNITO_INACTIVE_DESKTOP, ThemeProperties::TINT_FRAME_INCOGNITO_INACTIVE }, #endif }; @@ -355,9 +355,10 @@ IntToIntTable kFrameTintMap[] = { IntToIntTable kTabBackgroundMap[] = { { PRS_THEME_TAB_BACKGROUND, PRS_THEME_FRAME }, { PRS_THEME_TAB_BACKGROUND_INCOGNITO, PRS_THEME_FRAME_INCOGNITO }, -#if defined(OS_WIN) - { PRS_THEME_TAB_BACKGROUND_WIN, PRS_THEME_FRAME_WIN }, - { PRS_THEME_TAB_BACKGROUND_INCOGNITO_WIN, PRS_THEME_FRAME_INCOGNITO_WIN }, +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + { PRS_THEME_TAB_BACKGROUND_DESKTOP, PRS_THEME_FRAME_DESKTOP }, + { PRS_THEME_TAB_BACKGROUND_INCOGNITO_DESKTOP, + PRS_THEME_FRAME_INCOGNITO_DESKTOP }, #endif }; @@ -389,8 +390,8 @@ struct CropEntry kImagesToCrop[] = { { PRS_THEME_TOOLBAR, 200, false }, { PRS_THEME_BUTTON_BACKGROUND, 60, false }, { PRS_THEME_WINDOW_CONTROL_BACKGROUND, 50, false }, -#if defined(OS_WIN) - { PRS_THEME_TOOLBAR_WIN, 200, false } +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + { PRS_THEME_TOOLBAR_DESKTOP, 200, false } #endif }; @@ -768,9 +769,9 @@ void BrowserThemePack::GetThemeableImageIDRs(std::set<int>* result) { for (size_t i = 0; i < kPersistingImagesLength; ++i) result->insert(kPersistingImages[i].idr_id); -#if defined(OS_WIN) - for (size_t i = 0; i < kPersistingImagesWinDesktopAuraLength; ++i) - result->insert(kPersistingImagesWinDesktopAura[i].idr_id); +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + for (size_t i = 0; i < kPersistingImagesDesktopAuraLength; ++i) + result->insert(kPersistingImagesDesktopAura[i].idr_id); #endif } @@ -1208,10 +1209,10 @@ void BrowserThemePack::AddFileAtScaleToMap(const std::string& image_name, int id = GetPersistentIDByName(image_name); if (id != -1) (*file_paths)[id][scale_factor] = image_path; -#if defined(OS_WIN) +#if defined(USE_ASH) && !defined(OS_CHROMEOS) id = GetPersistentIDByNameHelper(image_name, - kPersistingImagesWinDesktopAura, - kPersistingImagesWinDesktopAuraLength); + kPersistingImagesDesktopAura, + kPersistingImagesDesktopAuraLength); if (id != -1) (*file_paths)[id][scale_factor] = image_path; #endif @@ -1336,15 +1337,15 @@ void BrowserThemePack::CreateFrameImages(ImageCache* images) const { // thing and just use the default images. int prs_base_id = 0; -#if defined(OS_WIN) - if (prs_id == PRS_THEME_FRAME_INCOGNITO_INACTIVE_WIN) { - prs_base_id = images->count(PRS_THEME_FRAME_INCOGNITO_WIN) ? - PRS_THEME_FRAME_INCOGNITO_WIN : PRS_THEME_FRAME_WIN; - } else if (prs_id == PRS_THEME_FRAME_INACTIVE_WIN) { - prs_base_id = PRS_THEME_FRAME_WIN; - } else if (prs_id == PRS_THEME_FRAME_INCOGNITO_WIN && - !images->count(PRS_THEME_FRAME_INCOGNITO_WIN)) { - prs_base_id = PRS_THEME_FRAME_WIN; +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + if (prs_id == PRS_THEME_FRAME_INCOGNITO_INACTIVE_DESKTOP) { + prs_base_id = images->count(PRS_THEME_FRAME_INCOGNITO_DESKTOP) ? + PRS_THEME_FRAME_INCOGNITO_DESKTOP : PRS_THEME_FRAME_DESKTOP; + } else if (prs_id == PRS_THEME_FRAME_INACTIVE_DESKTOP) { + prs_base_id = PRS_THEME_FRAME_DESKTOP; + } else if (prs_id == PRS_THEME_FRAME_INCOGNITO_DESKTOP && + !images->count(PRS_THEME_FRAME_INCOGNITO_DESKTOP)) { + prs_base_id = PRS_THEME_FRAME_DESKTOP; } #endif if (!prs_base_id) { @@ -1367,8 +1368,8 @@ void BrowserThemePack::CreateFrameImages(ImageCache* images) const { } else if (prs_base_id != prs_id && images->count(prs_base_id)) { frame = (*images)[prs_base_id]; } else if (prs_base_id == PRS_THEME_FRAME_OVERLAY) { -#if defined(OS_WIN) - if (images->count(PRS_THEME_FRAME_WIN)) { +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + if (images->count(PRS_THEME_FRAME_DESKTOP)) { #else if (images->count(PRS_THEME_FRAME)) { #endif @@ -1381,10 +1382,10 @@ void BrowserThemePack::CreateFrameImages(ImageCache* images) const { // If the theme doesn't specify an image, then apply the tint to // the default frame. frame = rb.GetImageNamed(IDR_THEME_FRAME); -#if defined(OS_WIN) && defined(USE_AURA) - if (prs_id >= PRS_THEME_FRAME_WIN && - prs_id <= PRS_THEME_FRAME_INCOGNITO_INACTIVE_WIN) { - frame = rb.GetImageNamed(IDR_THEME_FRAME_WIN); +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + if (prs_id >= PRS_THEME_FRAME_DESKTOP && + prs_id <= PRS_THEME_FRAME_INCOGNITO_INACTIVE_DESKTOP) { + frame = rb.GetImageNamed(IDR_THEME_FRAME_DESKTOP); } #endif } diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index 18e3dc7..6db628c 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -469,9 +469,9 @@ TEST_F(BrowserThemePackTest, CanParsePaths) { ParseImageNamesJSON(path_json, &out_file_paths); size_t expected_file_paths = 2u; -#if defined(OS_WIN) - // On Windows additional theme paths are generated to map to the special - // resource ids like IDR_THEME_FRAME_WIN, etc +#if defined(USE_ASH) && !defined(OS_CHROMEOS) + // On desktop builds with ash, additional theme paths are generated to map to + // the special resource ids like IDR_THEME_FRAME_DESKTOP, etc expected_file_paths = 3u; #endif EXPECT_EQ(expected_file_paths, out_file_paths.size()); diff --git a/chrome/browser/ui/ash/app_list/app_list_service_ash.cc b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc index ac1dc4f..58eb99b 100644 --- a/chrome/browser/ui/ash/app_list/app_list_service_ash.cc +++ b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc @@ -65,8 +65,9 @@ AppListControllerDelegate* AppListServiceAsh::GetControllerDelegate() { return controller_delegate_.get(); } -// Windows Ash additionally supports a native UI. See app_list_service_win.cc. -#if !defined(OS_WIN) +// Windows and Linux Ash additionally supports a native UI. See +// app_list_service_{win,linux}.cc. +#if defined(OS_CHROMEOS) // static AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) { diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc index 3522aa5..3061692 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_views.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_views.cc @@ -22,6 +22,7 @@ #include "chrome/browser/sync/sync_error_notifier_factory_ash.h" #include "chrome/browser/ui/ash/chrome_new_window_delegate.h" #include "chrome/browser/ui/ash/session_state_delegate_views.h" +#include "chrome/browser/ui/ash/solid_color_user_wallpaper_delegate.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" @@ -35,7 +36,6 @@ #if defined(OS_WIN) #include "chrome/browser/ui/ash/system_tray_delegate_win.h" -#include "chrome/browser/ui/ash/user_wallpaper_delegate_win.h" #endif namespace { @@ -149,7 +149,7 @@ class EmptyAccessibilityDelegate : public ash::AccessibilityDelegate { return ash::A11Y_ALERT_NONE; } - base::TimeDelta PlayShutdownSound() const OVERRIDE { + virtual base::TimeDelta PlayShutdownSound() const OVERRIDE { return base::TimeDelta(); } @@ -194,11 +194,7 @@ ash::AccessibilityDelegate* ChromeShellDelegate::CreateAccessibilityDelegate() { } ash::UserWallpaperDelegate* ChromeShellDelegate::CreateUserWallpaperDelegate() { -#if defined(OS_WIN) - return ::CreateUserWallpaperDelegate(); -#else - return NULL; -#endif + return CreateSolidColorUserWallpaperDelegate(); } void ChromeShellDelegate::Observe(int type, diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index 9f073ac..354ce1a 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc @@ -650,8 +650,10 @@ void ChromeLauncherController::LaunchApp(const std::string& app_id, return; } +#if defined(OS_WIN) if (LaunchedInNativeDesktop(app_id)) return; +#endif // The app will be created for the currently active profile. AppLaunchParams params(profile_, diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index 887cf81..7a51259 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc @@ -79,11 +79,13 @@ const char* offline_gmail_url = "https://mail.google.com/mail/mu/u"; const char* gmail_url = "https://mail.google.com/mail/u"; const char* kGmailLaunchURL = "https://mail.google.com/mail/ca"; +#if defined(OS_CHROMEOS) // As defined in /chromeos/dbus/cryptohome_client.cc. const char kUserIdHashSuffix[] = "-hash"; // An extension prefix. const char kCrxAppPrefix[] = "_crx_"; +#endif // ShelfModelObserver implementation that tracks what messages are invoked. class TestShelfModelObserver : public ash::ShelfModelObserver { diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc index a94acdf..1864112 100644 --- a/chrome/browser/ui/ash/screenshot_taker.cc +++ b/chrome/browser/ui/ash/screenshot_taker.cc @@ -58,7 +58,9 @@ const int kScreenshotMinimumIntervalInMS = 1000; const char kNotificationId[] = "screenshot"; +#if defined(OS_CHROMEOS) const char kNotificationOriginUrl[] = "chrome://screenshot"; +#endif const char kImageClipboardFormatPrefix[] = "<img src='data:image/png;base64,"; const char kImageClipboardFormatSuffix[] = "'>"; @@ -359,6 +361,7 @@ bool GetScreenshotDirectory(base::FilePath* directory) { return true; } +#if defined(OS_CHROMEOS) const int GetScreenshotNotificationTitle( ScreenshotTakerObserver::Result screenshot_result) { switch (screenshot_result) { @@ -382,6 +385,7 @@ const int GetScreenshotNotificationText( return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_FAIL; } } +#endif } // namespace diff --git a/chrome/browser/ui/ash/session_state_delegate_views.cc b/chrome/browser/ui/ash/session_state_delegate_views.cc index 2be4389..675a9bf 100644 --- a/chrome/browser/ui/ash/session_state_delegate_views.cc +++ b/chrome/browser/ui/ash/session_state_delegate_views.cc @@ -108,7 +108,7 @@ ash::SessionStateDelegate::SessionState SessionStateDelegate::GetSessionState() const ash::UserInfo* SessionStateDelegate::GetUserInfo( ash::MultiProfileIndex index) const { - return GetUserInfo(NULL); + return GetUserInfo(static_cast<content::BrowserContext*>(NULL)); } const ash::UserInfo* SessionStateDelegate::GetUserInfo( diff --git a/chrome/browser/ui/ash/session_state_delegate_views.h b/chrome/browser/ui/ash/session_state_delegate_views.h index 717fa61..3b32b29 100644 --- a/chrome/browser/ui/ash/session_state_delegate_views.h +++ b/chrome/browser/ui/ash/session_state_delegate_views.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/observer_list.h" +#include "ui/gfx/image/image_skia.h" namespace ash { class SessionStateObserver; @@ -45,6 +46,7 @@ class SessionStateDelegate : public ash::SessionStateDelegate { ash::SessionStateObserver* observer) OVERRIDE; virtual void RemoveSessionStateObserver( ash::SessionStateObserver* observer) OVERRIDE; + private: DISALLOW_COPY_AND_ASSIGN(SessionStateDelegate); }; diff --git a/chrome/browser/ui/ash/user_wallpaper_delegate_win.cc b/chrome/browser/ui/ash/solid_color_user_wallpaper_delegate.cc index 92ce758..f45a90a 100644 --- a/chrome/browser/ui/ash/user_wallpaper_delegate_win.cc +++ b/chrome/browser/ui/ash/solid_color_user_wallpaper_delegate.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/desktop_background/user_wallpaper_delegate.h" +#include "chrome/browser/ui/ash/solid_color_user_wallpaper_delegate.h" #include "ash/desktop_background/desktop_background_controller.h" +#include "ash/desktop_background/user_wallpaper_delegate.h" #include "ash/shell.h" #include "ash/wm/window_animations.h" #include "base/basictypes.h" @@ -86,6 +87,6 @@ class UserWallpaperDelegate : public ash::UserWallpaperDelegate { } // namespace -ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { +ash::UserWallpaperDelegate* CreateSolidColorUserWallpaperDelegate() { return new UserWallpaperDelegate(); } diff --git a/chrome/browser/ui/ash/solid_color_user_wallpaper_delegate.h b/chrome/browser/ui/ash/solid_color_user_wallpaper_delegate.h new file mode 100644 index 0000000..2634c2c --- /dev/null +++ b/chrome/browser/ui/ash/solid_color_user_wallpaper_delegate.h @@ -0,0 +1,14 @@ +// Copyright (c) 2013 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_ASH_SOLID_COLOR_USER_WALLPAPER_DELEGATE_H_ +#define CHROME_BROWSER_UI_ASH_SOLID_COLOR_USER_WALLPAPER_DELEGATE_H_ + +namespace ash { +class UserWallpaperDelegate; +} + +ash::UserWallpaperDelegate* CreateSolidColorUserWallpaperDelegate(); + +#endif // CHROME_BROWSER_UI_ASH_SOLID_COLOR_USER_WALLPAPER_DELEGATE_H_ diff --git a/chrome/browser/ui/ash/user_wallpaper_delegate_win.h b/chrome/browser/ui/ash/user_wallpaper_delegate_win.h deleted file mode 100644 index f83f95e..0000000 --- a/chrome/browser/ui/ash/user_wallpaper_delegate_win.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2013 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_ASH_USER_WALLPAPER_DELEGATE_WIN_H_ -#define CHROME_BROWSER_UI_ASH_USER_WALLPAPER_DELEGATE_WIN_H_ - -namespace ash { -class UserWallpaperDelegate; -} - -ash::UserWallpaperDelegate* CreateUserWallpaperDelegate(); - -#endif // CHROME_BROWSER_UI_ASH_USER_WALLPAPER_DELEGATE_WIN_H_ diff --git a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc index 3658a52..259b073 100644 --- a/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc +++ b/chrome/browser/ui/aura/chrome_browser_main_extra_parts_aura.cc @@ -24,6 +24,7 @@ #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" #include "chrome/common/pref_names.h" #include "ui/aura/window.h" +#include "ui/base/ime/input_method_initializer.h" #include "ui/native_theme/native_theme_aura.h" #include "ui/views/linux_ui/linux_ui.h" #endif @@ -70,7 +71,12 @@ chrome::HostDesktopType GetInitialDesktop() { command_line->HasSwitch(switches::kViewerLaunchViaAppId)) { return chrome::HOST_DESKTOP_TYPE_ASH; } +#elif defined(OS_LINUX) + const CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kOpenAsh)) + return chrome::HOST_DESKTOP_TYPE_ASH; #endif + return chrome::HOST_DESKTOP_TYPE_NATIVE; } #endif // !defined(OS_CHROMEOS) && defined(USE_ASH) @@ -85,10 +91,16 @@ ChromeBrowserMainExtraPartsAura::~ChromeBrowserMainExtraPartsAura() { void ChromeBrowserMainExtraPartsAura::PreEarlyInitialization() { #if defined(USE_X11) && !defined(OS_CHROMEOS) - // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port. - views::LinuxUI* gtk2_ui = BuildGtk2UI(); - gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow)); - views::LinuxUI::SetInstance(gtk2_ui); + if (GetInitialDesktop() != chrome::HOST_DESKTOP_TYPE_ASH) { + // TODO(erg): Refactor this into a dlopen call when we add a GTK3 port. + views::LinuxUI* gtk2_ui = BuildGtk2UI(); + gtk2_ui->SetNativeThemeOverride(base::Bind(&GetNativeThemeForWindow)); + views::LinuxUI::SetInstance(gtk2_ui); + } else { + // TODO(erg): Eventually, we'll need to somehow support IMEs in ash on + // Linux. + ui::InitializeInputMethodForTesting(); + } #endif } @@ -101,7 +113,8 @@ void ChromeBrowserMainExtraPartsAura::ToolkitInitialized() { #endif #if defined(USE_X11) && !defined(OS_CHROMEOS) - views::LinuxUI::instance()->Initialize(); + if (GetInitialDesktop() != chrome::HOST_DESKTOP_TYPE_ASH) + views::LinuxUI::instance()->Initialize(); #endif } diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc index 2730216..401f3e2 100644 --- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc +++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc @@ -120,10 +120,17 @@ const color_utils::HSL kDefaultTintFrameIncognitoInactive = { -1, 0.3f, 0.6f }; const color_utils::HSL kDefaultTintBackgroundTab = { -1, 0.5, 0.75 }; // A list of images that we provide while in gtk mode. +// +// TODO(erg): We list both the normal and *_DESKTOP versions of some of these +// images because in some contexts, we don't go through the +// chrome::MapThemeImage interface. That should be fixed, but tracking that +// down is Hard. const int kThemeImages[] = { IDR_THEME_TOOLBAR, IDR_THEME_TAB_BACKGROUND, + IDR_THEME_TAB_BACKGROUND_DESKTOP, IDR_THEME_TAB_BACKGROUND_INCOGNITO, + IDR_THEME_TAB_BACKGROUND_INCOGNITO_DESKTOP, IDR_FRAME, IDR_FRAME_INACTIVE, IDR_THEME_FRAME, @@ -1040,8 +1047,10 @@ SkBitmap Gtk2UI::GenerateGtkThemeBitmap(int id) const { return bitmap; } case IDR_THEME_TAB_BACKGROUND: + case IDR_THEME_TAB_BACKGROUND_DESKTOP: return GenerateTabImage(IDR_THEME_FRAME); case IDR_THEME_TAB_BACKGROUND_INCOGNITO: + case IDR_THEME_TAB_BACKGROUND_INCOGNITO_DESKTOP: return GenerateTabImage(IDR_THEME_FRAME_INCOGNITO); case IDR_FRAME: case IDR_THEME_FRAME: diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index 74d9db6..c7a1209 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc @@ -299,7 +299,7 @@ bool StartupBrowserCreator::LaunchBrowser( chrome::HostDesktopType host_desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; -#if defined(OS_WIN) && defined(USE_ASH) +#if defined(USE_ASH) && !defined(OS_CHROMEOS) // We want to maintain only one type of instance for now, either ASH // or desktop. // TODO(shrikant): Remove this code once we decide on running both desktop diff --git a/chrome/browser/ui/views/accelerator_table_unittest.cc b/chrome/browser/ui/views/accelerator_table_unittest.cc index 3984a38..d920d62 100644 --- a/chrome/browser/ui/views/accelerator_table_unittest.cc +++ b/chrome/browser/ui/views/accelerator_table_unittest.cc @@ -43,7 +43,7 @@ TEST(AcceleratorTableTest, CheckDuplicatedAccelerators) { } } -#if defined(USE_ASH) && !defined(OS_WIN) +#if defined(OS_CHROMEOS) TEST(AcceleratorTableTest, CheckDuplicatedAcceleratorsAsh) { std::set<AcceleratorMapping, Cmp> acclerators; const std::vector<AcceleratorMapping> accelerator_list(GetAcceleratorList()); diff --git a/chrome/browser/ui/views/app_list/linux/app_list_linux.cc b/chrome/browser/ui/views/app_list/linux/app_list_linux.cc index e513121..936d26d 100644 --- a/chrome/browser/ui/views/app_list/linux/app_list_linux.cc +++ b/chrome/browser/ui/views/app_list/linux/app_list_linux.cc @@ -90,6 +90,8 @@ void AppListLinux::MoveNearCursor(app_list::AppListView* view) { view->SetBubbleArrow(views::BubbleBorder::FLOAT); + AppListPositioner::ScreenEdge edge; +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) // In the Unity desktop environment, special case SCREEN_EDGE_LEFT. It is // always on the left side in Unity, but ShelfLocationInDisplay will not // detect this if the shelf is hidden. @@ -97,10 +99,10 @@ void AppListLinux::MoveNearCursor(app_list::AppListView* view) { // applies, but we currently have no way to detect whether Gnome Shell is // running. views::LinuxUI* ui = views::LinuxUI::instance(); - AppListPositioner::ScreenEdge edge; if (ui && ui->UnityIsRunning()) edge = AppListPositioner::SCREEN_EDGE_LEFT; else +#endif edge = ShelfLocationInDisplay(display); view->SetAnchorPoint(FindAnchorPoint(view->GetPreferredSize(), display, diff --git a/chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc b/chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc index c4e45f0..e6df273 100644 --- a/chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc +++ b/chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc @@ -8,8 +8,12 @@ #include "base/thread_task_runner_handle.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/shell_integration_linux.h" +#include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/app_list_controller_delegate_views.h" #include "chrome/browser/ui/app_list/app_list_shower_views.h" +#include "chrome/browser/ui/app_list/app_list_view_delegate.h" +#include "chrome/browser/ui/app_list/scoped_keep_alive.h" +#include "chrome/browser/ui/ash/app_list/app_list_service_ash.h" #include "chrome/browser/ui/views/app_list/linux/app_list_linux.h" #include "content/public/browser/browser_thread.h" #include "grit/chromium_strings.h" @@ -80,10 +84,14 @@ void AppListServiceLinux::MoveNearCursor(app_list::AppListView* view) { // static AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) { + if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) + return AppListServiceAsh::GetInstance(); + return AppListServiceLinux::GetInstance(); } // static void AppListService::InitAll(Profile* initial_profile) { + AppListServiceAsh::GetInstance()->Init(initial_profile); AppListServiceLinux::GetInstance()->Init(initial_profile); } diff --git a/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc b/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc index 6b858b7..6de8b94 100644 --- a/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc +++ b/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc @@ -68,6 +68,11 @@ ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() { void ChromeBrowserMainExtraPartsAsh::PreProfileInit() { if (chrome::ShouldOpenAshOnStartup()) { chrome::OpenAsh(); + +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) + ash::Shell::GetInstance()->CreateShelf(); + ash::Shell::GetInstance()->ShowShelf(); +#endif } else { #if !defined(OS_CHROMEOS) gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateWin); diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc index bd9dc65..e6c02e1 100644 --- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc +++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_win.cc @@ -58,7 +58,6 @@ class DesktopThemeProvider : public ui::ThemeProvider { virtual bool HasCustomImage(int id) const OVERRIDE { return delegate_->HasCustomImage( chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id)); - } virtual base::RefCountedMemory* GetRawData( int id, diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.cc b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.cc index 49f9ae2..79915b6 100644 --- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.cc +++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.cc @@ -4,16 +4,78 @@ #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h" +#include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" +#include "chrome/browser/ui/views/frame/browser_frame.h" +#include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/theme_image_mapper.h" + +namespace { + +// DesktopThemeProvider maps resource ids using MapThemeImage(). This is +// necessary for BrowserDesktopWindowTreeHostWin so that it uses the windows +// theme images rather than the ash theme images. +// +// This differs from the version in browser_desktop_window_tree_host_win.cc +// because we need to also look up whether we're using the native theme. +class DesktopThemeProvider : public ui::ThemeProvider { + public: + explicit DesktopThemeProvider(ThemeService* delegate) + : delegate_(delegate) { + } + + virtual bool UsingNativeTheme() const OVERRIDE { + return delegate_->UsingNativeTheme(); + } + virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE { + if (delegate_->UsingNativeTheme()) + return delegate_->GetImageSkiaNamed(id); + + return delegate_->GetImageSkiaNamed( + chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id)); + } + virtual SkColor GetColor(int id) const OVERRIDE { + return delegate_->GetColor(id); + } + virtual int GetDisplayProperty(int id) const OVERRIDE { + return delegate_->GetDisplayProperty(id); + } + virtual bool ShouldUseNativeFrame() const OVERRIDE { + return delegate_->ShouldUseNativeFrame(); + } + virtual bool HasCustomImage(int id) const OVERRIDE { + return delegate_->HasCustomImage( + chrome::MapThemeImage(chrome::HOST_DESKTOP_TYPE_NATIVE, id)); + } + virtual base::RefCountedMemory* GetRawData( + int id, + ui::ScaleFactor scale_factor) const OVERRIDE { + return delegate_->GetRawData(id, scale_factor); + } + + private: + ThemeService* delegate_; + + DISALLOW_COPY_AND_ASSIGN(DesktopThemeProvider); +}; + +} // namespace + //////////////////////////////////////////////////////////////////////////////// // BrowserDesktopWindowTreeHostX11, public: BrowserDesktopWindowTreeHostX11::BrowserDesktopWindowTreeHostX11( views::internal::NativeWidgetDelegate* native_widget_delegate, views::DesktopNativeWidgetAura* desktop_native_widget_aura, - BrowserView* browser_view) + BrowserView* browser_view, + BrowserFrame* browser_frame) : DesktopWindowTreeHostX11(native_widget_delegate, desktop_native_widget_aura), browser_view_(browser_view) { + scoped_ptr<ui::ThemeProvider> theme_provider( + new DesktopThemeProvider(ThemeServiceFactory::GetForProfile( + browser_view->browser()->profile()))); + browser_frame->SetThemeProvider(theme_provider.Pass()); } BrowserDesktopWindowTreeHostX11::~BrowserDesktopWindowTreeHostX11() { @@ -67,5 +129,6 @@ BrowserDesktopWindowTreeHost* BrowserFrame* browser_frame) { return new BrowserDesktopWindowTreeHostX11(native_widget_delegate, desktop_native_widget_aura, - browser_view); + browser_view, + browser_frame); } diff --git a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h index d746c80..1ed2264 100644 --- a/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h +++ b/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_x11.h @@ -23,7 +23,8 @@ class BrowserDesktopWindowTreeHostX11 BrowserDesktopWindowTreeHostX11( views::internal::NativeWidgetDelegate* native_widget_delegate, views::DesktopNativeWidgetAura* desktop_native_widget_aura, - BrowserView* browser_view); + BrowserView* browser_view, + BrowserFrame* browser_frame); virtual ~BrowserDesktopWindowTreeHostX11(); private: diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc index 2a4a3c6..dd411c7 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc @@ -19,11 +19,13 @@ namespace chrome { BrowserNonClientFrameView* CreateBrowserNonClientFrameView( BrowserFrame* frame, BrowserView* browser_view) { -#if defined(OS_WIN) +#if defined(USE_AURA) && !defined(OS_CHROMEOS) if (browser_view->browser()-> host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) { +#if defined(OS_WIN) if (frame->ShouldUseNativeFrame()) return new GlassBrowserFrameView(frame, browser_view); +#endif return new OpaqueBrowserFrameView(frame, browser_view); } #endif diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index 76f2329..71d49f4 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc @@ -1503,7 +1503,7 @@ void DragSingleTabToSeparateWindowInSecondDisplayStep2( #define MAYBE_DragSingleTabToSeparateWindowInSecondDisplay \ DISABLED_DragSingleTabToSeparateWindowInSecondDisplay #else -#define MAYBE_DragSingleTabToSeparateWindow \ +#define MAYBE_DragSingleTabToSeparateWindowInSecondDisplay \ DragSingleTabToSeparateWindowInSecondDisplay #endif // Drags from browser to a second display and releases input. @@ -2047,7 +2047,7 @@ void CancelDragTabToWindowInSeparateDisplayStep2( } // namespace -#if defined(OS_CHROMEOS) +#if defined(OS_CHROMEOS) || defined(OS_LINUX) // TODO(sky,sad): Disabled as it fails due to resize locks with a real // compositor. crbug.com/331924 #define MAYBE_CancelDragTabToWindowIn2ndDisplay \ @@ -2094,7 +2094,7 @@ IN_PROC_BROWSER_TEST_F( ui_controls::LEFT, ui_controls::UP)); } -#if defined(OS_CHROMEOS) +#if defined(OS_CHROMEOS) || defined(OS_LINUX) // TODO(sky,sad): Disabled as it fails due to resize locks with a real // compositor. crbug.com/331924 #define MAYBE_CancelDragTabToWindowIn1stDisplay \ @@ -2318,7 +2318,7 @@ IN_PROC_BROWSER_TEST_P(DetachToDockedTabDragControllerTest, #endif -#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) +#if defined(USE_ASH) && defined(OS_CHROMEOS) // TODO(win_ash,linux_ash) INSTANTIATE_TEST_CASE_P(TabDragging, DetachToBrowserInSeparateDisplayTabDragControllerTest, ::testing::Values("mouse", "touch")); @@ -2334,7 +2334,7 @@ INSTANTIATE_TEST_CASE_P(TabDragging, INSTANTIATE_TEST_CASE_P(TabDragging, DetachToBrowserTabDragControllerTestTouch, ::testing::Values("touch", "touch docked")); -#else +#elif defined(USE_ASH) && !defined(OS_LINUX) // TODO(linux_ash) INSTANTIATE_TEST_CASE_P(TabDragging, DetachToBrowserTabDragControllerTest, ::testing::Values("mouse")); diff --git a/chrome/browser/ui/views/theme_image_mapper.cc b/chrome/browser/ui/views/theme_image_mapper_chromeos.cc index 14ea061..14ea061 100644 --- a/chrome/browser/ui/views/theme_image_mapper.cc +++ b/chrome/browser/ui/views/theme_image_mapper_chromeos.cc diff --git a/chrome/browser/ui/views/theme_image_mapper_aura_win.cc b/chrome/browser/ui/views/theme_image_mapper_desktop.cc index 8ef3bb0..62dda54 100644 --- a/chrome/browser/ui/views/theme_image_mapper_aura_win.cc +++ b/chrome/browser/ui/views/theme_image_mapper_desktop.cc @@ -14,23 +14,23 @@ int MapThemeImage(HostDesktopType desktop_type, int resource) { switch (resource) { case IDR_CONTENT_TOP_CENTER: - return IDR_CONTENT_TOP_CENTER_WIN; + return IDR_CONTENT_TOP_CENTER_DESKTOP; case IDR_OTR_ICON: - return IDR_OTR_ICON_WIN; + return IDR_OTR_ICON_DESKTOP; case IDR_THEME_FRAME: - return IDR_THEME_FRAME_WIN; + return IDR_THEME_FRAME_DESKTOP; case IDR_THEME_FRAME_INACTIVE: - return IDR_THEME_FRAME_INACTIVE_WIN; + return IDR_THEME_FRAME_INACTIVE_DESKTOP; case IDR_THEME_FRAME_INCOGNITO: - return IDR_THEME_FRAME_INCOGNITO_WIN; + return IDR_THEME_FRAME_INCOGNITO_DESKTOP; case IDR_THEME_FRAME_INCOGNITO_INACTIVE: - return IDR_THEME_FRAME_INCOGNITO_INACTIVE_WIN; + return IDR_THEME_FRAME_INCOGNITO_INACTIVE_DESKTOP; case IDR_THEME_TAB_BACKGROUND: - return IDR_THEME_TAB_BACKGROUND_WIN; + return IDR_THEME_TAB_BACKGROUND_DESKTOP; case IDR_THEME_TAB_BACKGROUND_INCOGNITO: - return IDR_THEME_TAB_BACKGROUND_INCOGNITO_WIN; + return IDR_THEME_TAB_BACKGROUND_INCOGNITO_DESKTOP; case IDR_THEME_TOOLBAR: - return IDR_THEME_TOOLBAR_WIN; + return IDR_THEME_TOOLBAR_DESKTOP; default: break; } diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc index 4637433..a688ebf 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc @@ -67,7 +67,7 @@ void OpenBrowserUsingShelfOnRootWindow(aura::Window* root_window) { } // namespace -#if defined(OS_WIN) +#if !defined(OS_CHROMEOS) #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay DISABLED_OpenBrowserUsingShelfOnOtherDisplay #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay DISABLED_OpenBrowserUsingContextMenuOnOtherDisplay #else diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc index a33aa20..4bd32d5 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc @@ -92,9 +92,17 @@ scoped_ptr<TestBrowserWindowAura> CreateTestBrowserWindow( } // namespace +// On desktop linux aura, we currently don't use the ash frame, breaking some +// tests which expect ash sizes: http://crbug.com/303862 +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#define MAYBE_DefaultSizeCase DISABLED_DefaultSizeCase +#else +#define MAYBE_DefaultSizeCase DefaultSizeCase +#endif + // Test that the window is sized appropriately for the first run experience // where the default window bounds calculation is invoked. -TEST_F(WindowSizerAshTest, DefaultSizeCase) { +TEST_F(WindowSizerAshTest, MAYBE_DefaultSizeCase) { #if defined(OS_WIN) CommandLine::ForCurrentProcess()->AppendSwitch(switches::kOpenAsh); #endif @@ -451,8 +459,16 @@ TEST_F(WindowSizerAshTest, LastWindowOffscreenWithNonAggressiveRepositioning) { } } +// On desktop linux aura, we currently don't use the ash frame, breaking some +// tests which expect ash sizes: http://crbug.com/303862 +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#define MAYBE_PlaceNewWindows DISABLED_PlaceNewWindows +#else +#define MAYBE_PlaceNewWindows PlaceNewWindows +#endif + // Test the placement of newly created windows. -TEST_F(WindowSizerAshTest, PlaceNewWindows) { +TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindows) { // Create a browser which we can use to pass into the GetWindowBounds // function. scoped_ptr<TestingProfile> profile(new TestingProfile()); @@ -521,10 +537,18 @@ TEST_F(WindowSizerAshTest, PlaceNewWindows) { } } +// On desktop linux aura, we currently don't use the ash frame, breaking some +// tests which expect ash sizes: http://crbug.com/303862 +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#define MAYBE_PlaceNewBrowserWindowOnEmptyDesktop DISABLED_PlaceNewBrowserWindowOnEmptyDesktop +#else +#define MAYBE_PlaceNewBrowserWindowOnEmptyDesktop PlaceNewBrowserWindowOnEmptyDesktop +#endif + // Test the placement of newly created windows on an empty desktop. // This test supplements "PlaceNewWindows" by testing the creation of a newly // created browser window on an empty desktop. -TEST_F(WindowSizerAshTest, PlaceNewBrowserWindowOnEmptyDesktop) { +TEST_F(WindowSizerAshTest, MAYBE_PlaceNewBrowserWindowOnEmptyDesktop) { // Create a browser which we can use to pass into the GetWindowBounds // function. scoped_ptr<TestingProfile> profile(new TestingProfile()); @@ -695,8 +719,16 @@ TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) { } } +// On desktop linux aura, we currently don't use the ash frame, breaking some +// tests which expect ash sizes: http://crbug.com/303862 +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#define MAYBE_TestShowState DISABLED_TestShowState +#else +#define MAYBE_TestShowState TestShowState +#endif + // Test that the show state is properly returned for non default cases. -TEST_F(WindowSizerAshTest, TestShowState) { +TEST_F(WindowSizerAshTest, MAYBE_TestShowState) { scoped_ptr<TestingProfile> profile(new TestingProfile()); // Creating a browser & window to play with. diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index deab619..7d112ee 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2953,6 +2953,7 @@ 'browser/first_run/upgrade_util.cc', 'browser/first_run/upgrade_util.h', 'browser/first_run/upgrade_util_linux.cc', + 'browser/fullscreen_aurax11.cc', 'browser/icon_loader_auralinux.cc', 'browser/idle_linux.cc', 'browser/password_manager/native_backend_gnome_x.cc', @@ -3012,11 +3013,6 @@ '../build/linux/system.gyp:gnome_keyring', ], }], - ['use_ash==1', { - 'sources!': [ - 'browser/fullscreen_aurax11.cc', - ], - }], ['use_aura==1', { 'sources/': [ ['exclude', '^browser/lifetime/application_lifetime_stub.cc'], diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 489adf7..0d1f0df 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -358,6 +358,8 @@ 'browser/ui/ash/session_state_delegate_chromeos.h', 'browser/ui/ash/session_state_delegate_views.cc', 'browser/ui/ash/session_state_delegate_views.h', + 'browser/ui/ash/solid_color_user_wallpaper_delegate.cc', + 'browser/ui/ash/solid_color_user_wallpaper_delegate.h', 'browser/ui/ash/stub_user_accounts_delegate.cc', 'browser/ui/ash/stub_user_accounts_delegate.h', 'browser/ui/ash/system_tray_delegate_chromeos.cc', @@ -366,8 +368,6 @@ 'browser/ui/ash/system_tray_delegate_win.h', 'browser/ui/ash/user_accounts_delegate_chromeos.cc', 'browser/ui/ash/user_accounts_delegate_chromeos.h', - 'browser/ui/ash/user_wallpaper_delegate_win.cc', - 'browser/ui/ash/user_wallpaper_delegate_win.h', 'browser/ui/ash/volume_controller_chromeos.cc', 'browser/ui/ash/volume_controller_chromeos.h', 'browser/ui/aura/active_desktop_monitor.cc', @@ -1911,9 +1911,9 @@ 'browser/ui/views/tabs/window_finder_win.cc', 'browser/ui/views/tabs/window_finder_x11.cc', 'browser/ui/views/task_manager_view.cc', - 'browser/ui/views/theme_image_mapper.cc', 'browser/ui/views/theme_image_mapper.h', - 'browser/ui/views/theme_image_mapper_aura_win.cc', + 'browser/ui/views/theme_image_mapper_chromeos.cc', + 'browser/ui/views/theme_image_mapper_desktop.cc', 'browser/ui/views/toolbar/back_button.cc', 'browser/ui/views/toolbar/back_button.h', 'browser/ui/views/toolbar/browser_action_test_util_views.cc', @@ -2667,7 +2667,7 @@ 'browser/ui/views/message_center/web_notification_tray.cc', ], }], - ['use_aura==1 and use_ash==0 and use_ozone==0 and OS=="linux"', { + ['use_aura==1 and chromeos==0 and use_ozone==0 and OS=="linux"', { 'dependencies': [ # gtk2 is the only component that can interact with gtk2 in our new # world. @@ -2708,7 +2708,6 @@ ['OS=="win"', { 'sources/': [ ['exclude', '^browser/ui/views/apps/chrome_app_window_delegate_views.cc'], - ['exclude', '^browser/ui/views/theme_image_mapper.cc'], ['exclude', '^browser/ui/webui/certificate_viewer_webui.cc'], ['exclude', '^browser/ui/webui/certificate_viewer_webui.h'], ['exclude', '^browser/ui/webui/certificate_viewer_ui.cc'], @@ -2737,7 +2736,6 @@ ['exclude', '^browser/ui/views/frame/browser_desktop_window_tree_host_win.h'], ['exclude', '^browser/ui/views/frame/browser_desktop_window_tree_host_x11.cc'], ['exclude', '^browser/ui/views/frame/browser_desktop_window_tree_host_x11.h'], - ['exclude', '^browser/ui/views/theme_image_mapper_aura_win.cc'], ['exclude', '^browser/ui/webui/gesture_config_ui.cc'], ['exclude', '^browser/ui/webui/gesture_config_ui.h'], ['exclude', '^browser/ui/webui/salsa_ui.cc'], diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 0d9e8ac..32bb19f 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1792,10 +1792,20 @@ ], }], ], + }, { # else: OS != "win" + 'sources!': [ + 'app/chrome_command_ids.h', + 'app/chrome_dll.rc', + 'app/chrome_dll_resource.h', + 'app/chrome_version.rc.version', + ], + }], + ['chromeos==0 and use_aura==1', { 'sources!': [ - # use_aura currently sets use_ash on Windows. So take these tests out - # for win aura builds. - # TODO: enable these for win_ash browser tests. + # On Windows and Linux, we currently don't support enough of the + # ash environment to run these unit tests. + # + # TODO: enable these on windows and linux. 'browser/chromeos/system/tray_accessibility_browsertest.cc', 'browser/ui/ash/accelerator_commands_browsertest.cc', 'browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc', @@ -1804,13 +1814,6 @@ 'browser/ui/views/frame/app_non_client_frame_view_ash_browsertest.cc', 'browser/ui/views/frame/browser_non_client_frame_view_ash_browsertest.cc', ], - }, { # else: OS != "win" - 'sources!': [ - 'app/chrome_command_ids.h', - 'app/chrome_dll.rc', - 'app/chrome_dll_resource.h', - 'app/chrome_version.rc.version', - ], }], ['OS=="linux"', { 'dependencies': [ diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc index bdba76a..78fe294 100644 --- a/chrome/test/base/view_event_test_base.cc +++ b/chrome/test/base/view_event_test_base.cc @@ -111,13 +111,13 @@ void ViewEventTestBase::SetUp() { ui::InitializeContextFactoryForTests(enable_pixel_output); #if defined(USE_ASH) -#if defined(OS_WIN) +#if !defined(OS_CHROMEOS) // http://crbug.com/154081 use ash::Shell code path below on win_ash bots when // interactive_ui_tests is brought up on that platform. gfx::Screen::SetScreenInstance( gfx::SCREEN_TYPE_NATIVE, views::CreateDesktopScreen()); -#else // !OS_WIN +#else // !OS_CHROMEOS // Ash Shell can't just live on its own without a browser process, we need to // also create the message center. message_center::MessageCenter::Initialize(); @@ -133,7 +133,7 @@ void ViewEventTestBase::SetUp() { ->SetActiveUserSessionStarted(true); context = ash::Shell::GetPrimaryRootWindow(); context->GetHost()->Show(); -#endif // !OS_WIN +#endif // !OS_CHROMEOS aura::Env::CreateInstance(true); #elif defined(USE_AURA) // Instead of using the ash shell, use an AuraTestHelper to create and manage @@ -158,17 +158,15 @@ void ViewEventTestBase::TearDown() { ui::Clipboard::DestroyClipboardForCurrentThread(); #if defined(USE_ASH) -#if !defined(OS_WIN) - ash::Shell::DeleteInstance(); #if defined(OS_CHROMEOS) + ash::Shell::DeleteInstance(); chromeos::NetworkHandler::Shutdown(); chromeos::CrasAudioHandler::Shutdown(); chromeos::DBusThreadManager::Shutdown(); -#endif // Ash Shell can't just live on its own without a browser process, we need to // also shut down the message center. message_center::MessageCenter::Shutdown(); -#endif // !OS_WIN +#endif aura::Env::DeleteInstance(); #elif defined(USE_AURA) aura_test_helper_->TearDown(); |