Commit 5b121135 authored by msw's avatar msw Committed by Commit bot

mash: Remove shelf util functions; use WmWindow properties.

Move aura window properties to WmWindowAura.
(towards supporting [Shelf]WindowWatcher in mash)

Cleanup ShelfItem and ShelfItemDetails structs.
Remove unused ash support for UserManagerView

BUG=634150
TEST=Automated tests; no shelf functionality changes.
R=sky@chromium.org

Review-Url: https://codereview.chromium.org/2332393003
Cr-Commit-Position: refs/heads/master@{#418723}
parent 0a7922ab
......@@ -686,8 +686,6 @@ component("ash") {
"shelf/dimmer_view.h",
"shelf/shelf_bezel_event_handler.cc",
"shelf/shelf_bezel_event_handler.h",
"shelf/shelf_util.cc",
"shelf/shelf_util.h",
"shelf/shelf_window_targeter.cc",
"shelf/shelf_window_targeter.h",
"shell.cc",
......
......@@ -8,6 +8,7 @@
#include "ash/aura/wm_root_window_controller_aura.h"
#include "ash/aura/wm_shell_aura.h"
#include "ash/common/ash_constants.h"
#include "ash/common/shelf/shelf_item_types.h"
#include "ash/common/shell_window_ids.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm_layout_manager.h"
......@@ -15,7 +16,6 @@
#include "ash/common/wm_window_observer.h"
#include "ash/common/wm_window_property.h"
#include "ash/screen_util.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
#include "ash/wm/resize_handle_window_targeter.h"
#include "ash/wm/resize_shadow_controller.h"
......@@ -44,11 +44,17 @@
#include "ui/wm/core/visibility_controller.h"
#include "ui/wm/core/window_util.h"
DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*);
DECLARE_WINDOW_PROPERTY_TYPE(ash::WmWindowAura*);
namespace ash {
DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmWindowAura, kWmWindowKey, nullptr);
DEFINE_WINDOW_PROPERTY_KEY(ShelfID, kShelfIDKey, kInvalidShelfID);
DEFINE_OWNED_WINDOW_PROPERTY_KEY(ShelfItemDetails,
kShelfItemDetailsKey,
nullptr);
DEFINE_OWNED_WINDOW_PROPERTY_KEY(WmWindowAura, kWmWindowKey, nullptr);
static_assert(aura::Window::kInitialId == kShellWindowId_Invalid,
"ids must match");
......@@ -310,7 +316,7 @@ int WmWindowAura::GetIntProperty(WmWindowProperty key) {
return window_->GetProperty(aura::client::kModalKey);
if (key == WmWindowProperty::SHELF_ID)
return GetShelfIDForWindow(window_);
return window_->GetProperty(kShelfIDKey);
if (key == WmWindowProperty::TOP_VIEW_INSET)
return window_->GetProperty(aura::client::kTopViewInset);
......@@ -321,7 +327,7 @@ int WmWindowAura::GetIntProperty(WmWindowProperty key) {
void WmWindowAura::SetIntProperty(WmWindowProperty key, int value) {
if (key == WmWindowProperty::SHELF_ID) {
SetShelfIDForWindow(value, window_);
window_->SetProperty(kShelfIDKey, value);
return;
}
if (key == WmWindowProperty::TOP_VIEW_INSET) {
......@@ -807,7 +813,7 @@ void WmWindowAura::OnWindowPropertyChanged(aura::Window* window,
wm_property = WmWindowProperty::EXCLUDE_FROM_MRU;
} else if (key == aura::client::kModalKey) {
wm_property = WmWindowProperty::MODAL_TYPE;
} else if (key == kShelfID) {
} else if (key == kShelfIDKey) {
wm_property = WmWindowProperty::SHELF_ID;
} else if (key == kShelfItemDetailsKey) {
wm_property = WmWindowProperty::SHELF_ITEM_DETAILS;
......
......@@ -10,7 +10,6 @@
namespace ash {
const int kInvalidImageResourceID = -1;
const int kTimeToSwitchBackgroundMs = 1000;
const int kWorkspaceAreaVisibleInset = 2;
const int kWorkspaceAreaAutoHideInset = 5;
......
......@@ -29,7 +29,7 @@ enum ShelfConstant {
};
// Invalid image resource id used for ShelfItemDetails.
extern const int kInvalidImageResourceID;
const int kInvalidImageResourceID = -1;
// We reserve a small area on the edge of the workspace area to ensure that
// the resize handle at the edge of the window can be hit.
......
......@@ -4,18 +4,12 @@
#include "ash/common/shelf/shelf_item_types.h"
#include "ash/common/shelf/shelf_constants.h"
namespace ash {
ShelfItem::ShelfItem()
: type(TYPE_UNDEFINED), id(kInvalidShelfID), status(STATUS_CLOSED) {}
ShelfItem::ShelfItem() {}
ShelfItem::~ShelfItem() {}
ShelfItemDetails::ShelfItemDetails()
: type(TYPE_UNDEFINED), image_resource_id(kInvalidImageResourceID) {}
ShelfItemDetails::ShelfItemDetails() {}
ShelfItemDetails::~ShelfItemDetails() {}
} // namespace ash
......@@ -8,6 +8,7 @@
#include <vector>
#include "ash/ash_export.h"
#include "ash/common/shelf/shelf_constants.h"
#include "base/strings/string16.h"
#include "ui/gfx/image/image_skia.h"
......@@ -61,31 +62,30 @@ struct ASH_EXPORT ShelfItem {
ShelfItem();
~ShelfItem();
ShelfItemType type;
ShelfItemType type = TYPE_UNDEFINED;
// Image to display in the shelf.
gfx::ImageSkia image;
// Assigned by the model when the item is added.
ShelfID id;
ShelfID id = kInvalidShelfID;
// Running status.
ShelfItemStatus status;
ShelfItemStatus status = STATUS_CLOSED;
};
typedef std::vector<ShelfItem> ShelfItems;
// ShelfItemDetails may be set on Window (by way of
// SetShelfItemDetailsForWindow) to make the window appear in the shelf. See
// ShelfWindowWatcher for details.
// Windows with ShelfItemDetails appear in the shelf.
// See ShelfWindowWatcher for details.
struct ASH_EXPORT ShelfItemDetails {
ShelfItemDetails();
~ShelfItemDetails();
ShelfItemType type;
ShelfItemType type = TYPE_UNDEFINED;
// Resource id of the image to display on the shelf.
int image_resource_id;
int image_resource_id = kInvalidImageResourceID;
// Title of the item.
base::string16 title;
......
......@@ -9,7 +9,6 @@
#include "ash/common/login_status.h"
#include "ash/common/shelf/shelf_model.h"
#include "ash/common/wm_shell.h"
#include "ash/shelf/shelf_util.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/test_shelf_delegate.h"
#include "ash/test/test_system_tray_delegate.h"
......
// Copyright 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.
#include "ash/shelf/shelf_util.h"
#include "ash/common/shelf/shelf_constants.h"
#include "ui/aura/window_property.h"
DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*);
namespace ash {
DEFINE_WINDOW_PROPERTY_KEY(ShelfID, kShelfID, kInvalidShelfID);
// ShelfItemDetails for kShelfItemDetaildKey is owned by the window
// and will be freed automatically.
DEFINE_OWNED_WINDOW_PROPERTY_KEY(ShelfItemDetails, kShelfItemDetailsKey, NULL);
void SetShelfIDForWindow(ShelfID id, aura::Window* window) {
if (!window)
return;
window->SetProperty(kShelfID, id);
}
ShelfID GetShelfIDForWindow(const aura::Window* window) {
DCHECK(window);
return window->GetProperty(kShelfID);
}
void SetShelfItemDetailsForWindow(aura::Window* window,
const ShelfItemDetails& details) {
// |item_details| is owned by |window|.
ShelfItemDetails* item_details = new ShelfItemDetails(details);
window->SetProperty(kShelfItemDetailsKey, item_details);
}
void SetShelfItemDetailsForDialogWindow(aura::Window* window,
int image_resource_id,
const base::string16& title) {
// |item_details| is owned by |window|.
ShelfItemDetails* item_details = new ShelfItemDetails;
item_details->type = TYPE_DIALOG;
item_details->image_resource_id = image_resource_id;
item_details->title = title;
window->SetProperty(kShelfItemDetailsKey, item_details);
}
void ClearShelfItemDetailsForWindow(aura::Window* window) {
window->ClearProperty(kShelfItemDetailsKey);
}
const ShelfItemDetails* GetShelfItemDetailsForWindow(aura::Window* window) {
return window->GetProperty(kShelfItemDetailsKey);
}
} // namespace ash
// Copyright 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 ASH_SHELF_SHELF_UTIL_H_
#define ASH_SHELF_SHELF_UTIL_H_
#include "ash/ash_export.h"
#include "ash/common/shelf/shelf_item_types.h"
#include "ash/common/shelf/shelf_types.h"
#include "base/strings/string16.h"
#include "ui/aura/window.h"
namespace aura {
class Window;
}
namespace ash {
// A property key to store the id of the ShelfItem associated with the window.
extern const aura::WindowProperty<ShelfID>* const kShelfID;
// A property key to store the resource id and title of the item shown on the
// shelf for this window.
extern const aura::WindowProperty<ShelfItemDetails*>* const
kShelfItemDetailsKey;
// Associates ShelfItem of |id| with specified |window|.
ASH_EXPORT void SetShelfIDForWindow(ShelfID id, aura::Window* window);
// Returns the id of the ShelfItem associated with the specified |window|,
// or 0 if there isn't one.
// Note: Window of a tabbed browser will return the |ShelfID| of the
// currently active tab.
ASH_EXPORT ShelfID GetShelfIDForWindow(const aura::Window* window);
// Creates a new ShelfItemDetails instance from |details| and sets it for
// |window|.
ASH_EXPORT void SetShelfItemDetailsForWindow(aura::Window* window,
const ShelfItemDetails& details);
// Creates a new ShelfItemDetails instance with type DIALOG, image id
// |image_resource_id|, and title |title|, and sets it for |window|.
ASH_EXPORT void SetShelfItemDetailsForDialogWindow(aura::Window* window,
int image_resource_id,
const base::string16& title);
// Clears ShelfItemDetails for |window|.
// If |window| has a ShelfItem by SetShelfItemDetailsForWindow(), it will
// be removed.
ASH_EXPORT void ClearShelfItemDetailsForWindow(aura::Window* window);
// Returns ShelfItemDetails for |window| or NULL if it doesn't have.
// Returned ShelfItemDetails object is owned by the |window|.
ASH_EXPORT const ShelfItemDetails* GetShelfItemDetailsForWindow(
aura::Window* window);
} // namespace ash
#endif // ASH_SHELF_SHELF_UTIL_H_
......@@ -6,12 +6,13 @@
#include <utility>
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shelf/shelf_model.h"
#include "ash/common/shelf/shelf_widget.h"
#include "ash/common/shell_window_ids.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window_property.h"
#include "ash/display/window_tree_host_manager.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
#include "ash/shell/window_watcher_shelf_item_delegate.h"
#include "ash/wm/window_util.h"
......@@ -115,7 +116,7 @@ void WindowWatcher::OnWindowAdded(aura::Window* new_window) {
std::unique_ptr<ShelfItemDelegate> delegate(
new WindowWatcherShelfItemDelegate(id, this));
model->SetShelfItemDelegate(id, std::move(delegate));
SetShelfIDForWindow(id, new_window);
WmWindowAura::Get(new_window)->SetIntProperty(WmWindowProperty::SHELF_ID, id);
}
void WindowWatcher::OnWillRemoveWindow(aura::Window* window) {
......
......@@ -6,8 +6,9 @@
#include <utility>
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shelf/shelf_model.h"
#include "ash/shelf/shelf_util.h"
#include "ash/common/wm_window_property.h"
#include "ash/test/test_shelf_item_delegate.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
......@@ -34,7 +35,9 @@ void TestShelfDelegate::AddShelfItem(aura::Window* window) {
void TestShelfDelegate::AddShelfItem(aura::Window* window,
const std::string& app_id) {
AddShelfItem(window, STATUS_CLOSED);
AddShelfIDToAppIDMapping(GetShelfIDForWindow(window), app_id);
WmWindow* wm_window = WmWindowAura::Get(window);
ShelfID shelf_id = wm_window->GetIntProperty(WmWindowProperty::SHELF_ID);
AddShelfIDToAppIDMapping(shelf_id, app_id);
}
void TestShelfDelegate::AddShelfItem(aura::Window* window,
......@@ -52,11 +55,12 @@ void TestShelfDelegate::AddShelfItem(aura::Window* window,
std::unique_ptr<ShelfItemDelegate> delegate(
new TestShelfItemDelegate(window));
model_->SetShelfItemDelegate(id, std::move(delegate));
SetShelfIDForWindow(id, window);
WmWindowAura::Get(window)->SetIntProperty(WmWindowProperty::SHELF_ID, id);
}
void TestShelfDelegate::RemoveShelfItemForWindow(aura::Window* window) {
ShelfID shelf_id = GetShelfIDForWindow(window);
WmWindow* wm_window = WmWindowAura::Get(window);
ShelfID shelf_id = wm_window->GetIntProperty(WmWindowProperty::SHELF_ID);
if (shelf_id == 0)
return;
int index = model_->ItemIndexByID(shelf_id);
......
......@@ -18,9 +18,9 @@
#include "ash/common/wm/window_state.h"
#include "ash/common/wm_root_window_controller.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window_property.h"
#include "ash/display/display_manager.h"
#include "ash/screen_util.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
......@@ -228,7 +228,7 @@ class PanelLayoutManagerTest : public test::AshTestBase {
test_api.SetAnimationDuration(1);
test_api.RunMessageLoopUntilAnimationsDone();
int index = WmShell::Get()->shelf_model()->ItemIndexByID(
GetShelfIDForWindow(window));
WmWindowAura::Get(window)->GetIntProperty(WmWindowProperty::SHELF_ID));
gfx::Rect bounds = test_api.GetButton(index)->GetBoundsInScreen();
ui::test::EventGenerator& event_generator = GetEventGenerator();
......
......@@ -14,8 +14,8 @@
#include "ash/common/wm/window_state.h"
#include "ash/common/wm/wm_event.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window_property.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/cursor_manager_test_api.h"
......@@ -134,7 +134,8 @@ class PanelWindowResizerTest : public test::AshTestBase {
for (std::vector<aura::Window *>::const_iterator
iter = window_order.begin();
iter != window_order.end(); ++iter, ++panel_index) {
ShelfID id = GetShelfIDForWindow(*iter);
ShelfID id =
WmWindowAura::Get(*iter)->GetIntProperty(WmWindowProperty::SHELF_ID);
EXPECT_EQ(id, model_->items()[panel_index].id);
}
}
......
......@@ -4,7 +4,6 @@
#include "ash/common/shelf/shelf_delegate.h"
#include "ash/common/wm_shell.h"
#include "ash/shelf/shelf_util.h"
#include "ash/wm/window_util.h"
#include "base/macros.h"
#include "base/run_loop.h"
......
......@@ -5,14 +5,15 @@
#include <string>
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shelf/shelf_delegate.h"
#include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm_lookup.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window_property.h"
#include "ash/display/display_manager.h"
#include "ash/display/screen_orientation_controller_chromeos.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
#include "ash/wm/window_state_aura.h"
#include "ash/wm/window_util.h"
......@@ -373,7 +374,8 @@ void ArcAppWindowLauncherController::AttachControllerToWindowIfNeeded(
app_window->set_widget(views::Widget::GetWidgetForNativeWindow(window));
RegisterApp(app_window.get());
DCHECK(app_window->controller());
ash::SetShelfIDForWindow(app_window->shelf_id(), window);
ash::WmWindowAura::Get(window)->SetIntProperty(
ash::WmWindowProperty::SHELF_ID, app_window->shelf_id());
chrome::MultiUserWindowManager::GetInstance()->SetWindowOwner(
window,
user_manager::UserManager::Get()->GetPrimaryUser()->GetAccountId());
......
......@@ -6,11 +6,12 @@
#include <vector>
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shelf/shelf_delegate.h"
#include "ash/common/shelf/shelf_model.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window_property.h"
#include "ash/resources/grit/ash_resources.h"
#include "ash/shelf/shelf_util.h"
#include "ash/wm/window_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h"
......@@ -117,15 +118,16 @@ void BrowserShortcutLauncherItemController::UpdateBrowserItemState() {
void BrowserShortcutLauncherItemController::SetShelfIDForBrowserWindowContents(
Browser* browser,
content::WebContents* web_contents) {
// We need to call SetShelfIDForWindow for V1 applications since they are
// We need to set the window ShelfID for V1 applications since they are
// content which might change and as such change the application type.
if (!browser || !IsBrowserFromActiveUser(browser) ||
IsSettingsBrowser(browser))
return;
ash::SetShelfIDForWindow(
launcher_controller()->GetShelfIDForWebContents(web_contents),
browser->window()->GetNativeWindow());
ash::WmWindowAura::Get(browser->window()->GetNativeWindow())
->SetIntProperty(
ash::WmWindowProperty::SHELF_ID,
launcher_controller()->GetShelfIDForWebContents(web_contents));
}
bool BrowserShortcutLauncherItemController::IsOpen() const {
......
......@@ -4,8 +4,10 @@
#include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shelf/shelf_item_types.h"
#include "ash/common/wm_window_property.h"
#include "ash/resources/grit/ash_resources.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
#include "ash/wm/window_util.h"
#include "base/macros.h"
......@@ -90,10 +92,12 @@ class BrowserStatusMonitor::SettingsWindowObserver
// SettingsWindowManagerObserver
void OnNewSettingsWindow(Browser* settings_browser) override {
ash::SetShelfItemDetailsForDialogWindow(
settings_browser->window()->GetNativeWindow(),
IDR_ASH_SHELF_ICON_SETTINGS,
l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE));
ash::ShelfItemDetails item_details;
item_details.type = ash::TYPE_DIALOG;
item_details.image_resource_id = IDR_ASH_SHELF_ICON_SETTINGS;
item_details.title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE);
aura::Window* aura_window = settings_browser->window()->GetNativeWindow();
ash::WmWindowAura::Get(aura_window)->SetShelfItemDetails(item_details);
}
private:
......
......@@ -16,7 +16,7 @@
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm_shell.h"
#include "ash/shelf/shelf_util.h"
#include "ash/common/wm_window_property.h"
#include "ash/shell.h"
#include "ash/test/shelf_view_test_api.h"
#include "ash/wm/window_state_aura.h"
......@@ -2125,34 +2125,36 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
EXPECT_FALSE(window_state->IsMinimized());
}
// Check that GetShelfIDForWindow() returns |ShelfID| of the active tab.
// Check that the window's ShelfID property matches that of the active tab.
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) {
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
EXPECT_EQ(2, model_->item_count());
aura::Window* window = browser()->window()->GetNativeWindow();
ash::WmWindow* window =
ash::WmWindowAura::Get(browser()->window()->GetNativeWindow());
int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT);
ash::ShelfID browser_id = model_->items()[browser_index].id;
EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window));
ash::ShelfID id = window->GetIntProperty(ash::WmWindowProperty::SHELF_ID);
EXPECT_EQ(browser_id, id);
ash::ShelfID app_id = CreateShortcut("app1");
EXPECT_EQ(3, model_->item_count());
// Creates a new tab for "app1" and checks that GetShelfIDForWindow()
// returns |ShelfID| of "app1".
// Create and activate a new tab for "app1" and expect an application ShelfID.
WmShelf::ActivateShelfItem(model_->ItemIndexByID(app_id));
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(app_id, ash::GetShelfIDForWindow(window));
id = window->GetIntProperty(ash::WmWindowProperty::SHELF_ID);
EXPECT_EQ(app_id, id);
// Makes tab at index 0(NTP) as an active tab and checks that
// GetShelfIDForWindow() returns |ShelfID| of browser shortcut.
// Activate the tab at index 0 (NTP) and expect a browser ShelfID.
browser()->tab_strip_model()->ActivateTabAt(0, false);
EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window));
id = window->GetIntProperty(ash::WmWindowProperty::SHELF_ID);
EXPECT_EQ(browser_id, id);
}
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, OverflowBubble) {
......
......@@ -4,9 +4,10 @@
#include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.h"
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shelf/shelf_delegate.h"
#include "ash/common/wm_shell.h"
#include "ash/shelf/shelf_util.h"
#include "ash/common/wm_window_property.h"
#include "ash/wm/window_util.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
......@@ -17,6 +18,7 @@
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/common/extension.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
using extensions::AppWindow;
......@@ -180,7 +182,8 @@ void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) {
app_controller_map_[app_shelf_id] = controller;
}
owner()->SetItemStatus(shelf_id, status);
ash::SetShelfIDForWindow(shelf_id, window);
ash::WmWindowAura::Get(window)->SetIntProperty(
ash::WmWindowProperty::SHELF_ID, shelf_id);
}
void ExtensionAppWindowLauncherController::UnregisterApp(aura::Window* window) {
......
......@@ -9,14 +9,12 @@
#include <map>
#include <string>
#include "ash/shelf/shelf_util.h"
#include "base/macros.h"
#include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
#include "extensions/browser/app_window/app_window_registry.h"
#include "ui/aura/window_observer.h"
namespace aura {
class Window;
}
......
......@@ -4,8 +4,10 @@
#include "chrome/browser/ui/ash/launcher/multi_profile_browser_status_monitor.h"
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shelf/shelf_item_types.h"
#include "ash/common/wm_window_property.h"
#include "ash/resources/grit/ash_resources.h"
#include "ash/shelf/shelf_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
......@@ -86,13 +88,15 @@ void MultiProfileBrowserStatusMonitor::ActiveUserChanged(
browser)) {
continue;
}
aura::Window* aura_window = browser->window()->GetNativeWindow();
if (multi_user_util::IsProfileFromActiveUser(browser->profile())) {
ash::SetShelfItemDetailsForDialogWindow(
browser->window()->GetNativeWindow(),
IDR_ASH_SHELF_ICON_SETTINGS,
l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE));
ash::ShelfItemDetails item_details;
item_details.type = ash::TYPE_DIALOG;
item_details.image_resource_id = IDR_ASH_SHELF_ICON_SETTINGS;
item_details.title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE);
ash::WmWindowAura::Get(aura_window)->SetShelfItemDetails(item_details);
} else {
ash::ClearShelfItemDetailsForWindow(browser->window()->GetNativeWindow());
ash::WmWindowAura::Get(aura_window)->ClearShelfItemDetails();
}
}
......
......@@ -45,12 +45,6 @@
#include "ui/views/win/hwnd_util.h"
#endif
#if defined(USE_ASH)
#include "ash/resources/grit/ash_resources.h" // nogncheck
#include "ash/shelf/shelf_util.h" // nogncheck
#include "ash/wm/window_util.h" // nogncheck
#endif
namespace {
// An open User Manager window. There can only be one open at a time. This
......@@ -242,10 +236,8 @@ UserManagerView::UserManagerView()
: web_view_(nullptr),
delegate_(nullptr),
user_manager_started_showing_(base::Time()) {
#if !defined(USE_ASH)
keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::USER_MANAGER_VIEW,
KeepAliveRestartOption::DISABLED));
#endif // !defined(USE_ASH)
}
UserManagerView::~UserManagerView() {
......@@ -353,12 +345,6 @@ void UserManagerView::Init(Profile* system_profile, const GURL& url) {
views::HWNDForWidget(GetWidget()));
#endif
#if defined(USE_ASH)
gfx::NativeWindow native_window = GetWidget()->GetNativeWindow();
ash::SetShelfItemDetailsForDialogWindow(
native_window, IDR_ASH_SHELF_LIST_BROWSER, native_window->title());
#endif
web_view_->LoadInitialURL(url);
content::RenderWidgetHostView* rwhv =
web_view_->GetWebContents()->GetRenderWidgetHostView();
......
......@@ -34,9 +34,12 @@
#include "ui/views/window/dialog_client_view.h"
#if defined(USE_ASH)
#include "ash/resources/grit/ash_resources.h" // nogncheck
#include "ash/shelf/shelf_util.h" // nogncheck
#include "ash/wm/window_util.h" // nogncheck
#include "ash/common/shelf/shelf_item_types.h" // nogncheck
#include "ash/common/wm_lookup.h" // nogncheck
#include "ash/common/wm_window.h" // nogncheck
#include "ash/common/wm_window_property.h" // nogncheck
#include "ash/resources/grit/ash_resources.h" // nogncheck
#include "ash/wm/window_util.h" // nogncheck
#endif // defined(USE_ASH)
#if defined(OS_WIN)
......@@ -100,10 +103,13 @@ task_manager::TaskManagerTableModel* TaskManagerView::Show(Browser* browser) {
focus_manager->SetFocusedView(g_task_manager_view->tab_table_);
#if defined(USE_ASH)
gfx::NativeWindow native_window =
g_task_manager_view->GetWidget()->GetNativeWindow();
ash::SetShelfItemDetailsForDialogWindow(
native_window, IDR_ASH_SHELF_ICON_TASK_MANAGER, native_window->title());
ash::WmWindow* wm_window = ash::WmLookup::Get()->GetWindowForWidget(
g_task_manager_view->GetWidget());
ash::ShelfItemDetails item_details;
item_details.type = ash::TYPE_DIALOG;
item_details.image_resource_id = IDR_ASH_SHELF_ICON_TASK_MANAGER;
item_details.title = wm_window->GetTitle();
wm_window->SetShelfItemDetails(item_details);
#endif
return g_task_manager_view->table_model_.get();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment