| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" | 5 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_item_types.h" | 7 #include "ash/common/shelf/shelf_item_types.h" |
| 8 #include "ash/resources/grit/ash_resources.h" | 8 #include "ash/resources/grit/ash_resources.h" |
| 9 #include "ash/wm/window_properties.h" | 9 #include "ash/wm/window_properties.h" |
| 10 #include "chrome/browser/ui/ash/ash_util.h" | 10 #include "chrome/browser/ui/ash/ash_util.h" |
| 11 #include "chrome/browser/ui/ash/property_util.h" | |
| 12 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/settings_window_manager.h" | 13 #include "chrome/browser/ui/settings_window_manager.h" |
| 15 #include "components/strings/grit/components_strings.h" | 14 #include "components/strings/grit/components_strings.h" |
| 16 #include "services/ui/public/cpp/property_type_converters.h" | 15 #include "services/ui/public/cpp/property_type_converters.h" |
| 17 #include "services/ui/public/cpp/window.h" | 16 #include "services/ui/public/cpp/window.h" |
| 18 #include "services/ui/public/cpp/window_property.h" | 17 #include "services/ui/public/cpp/window_property.h" |
| 19 #include "services/ui/public/interfaces/window_manager.mojom.h" | 18 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 20 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
| 21 #include "ui/aura/mus/mus_util.h" | 20 #include "ui/aura/mus/mus_util.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 aura_window_tracker_.reset(new AuraWindowSettingsTitleTracker); | 75 aura_window_tracker_.reset(new AuraWindowSettingsTitleTracker); |
| 77 chrome::SettingsWindowManager::GetInstance()->AddObserver(this); | 76 chrome::SettingsWindowManager::GetInstance()->AddObserver(this); |
| 78 } | 77 } |
| 79 | 78 |
| 80 SettingsWindowObserver::~SettingsWindowObserver() { | 79 SettingsWindowObserver::~SettingsWindowObserver() { |
| 81 chrome::SettingsWindowManager::GetInstance()->RemoveObserver(this); | 80 chrome::SettingsWindowManager::GetInstance()->RemoveObserver(this); |
| 82 } | 81 } |
| 83 | 82 |
| 84 void SettingsWindowObserver::OnNewSettingsWindow(Browser* settings_browser) { | 83 void SettingsWindowObserver::OnNewSettingsWindow(Browser* settings_browser) { |
| 85 aura::Window* window = settings_browser->window()->GetNativeWindow(); | 84 aura::Window* window = settings_browser->window()->GetNativeWindow(); |
| 86 property_util::SetTitle(window, | 85 window->SetTitle(l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); |
| 87 l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); | 86 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); |
| 88 property_util::SetIntProperty(window, ash::kShelfItemTypeKey, | |
| 89 ash::TYPE_DIALOG); | |
| 90 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 87 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 91 gfx::ImageSkia* icon = rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_SETTINGS); | 88 gfx::ImageSkia* icon = rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_SETTINGS); |
| 92 // The new gfx::ImageSkia instance is owned by the window itself. | 89 // The new gfx::ImageSkia instance is owned by the window itself. |
| 93 window->SetProperty(aura::client::kWindowIconKey, new gfx::ImageSkia(*icon)); | 90 window->SetProperty(aura::client::kWindowIconKey, new gfx::ImageSkia(*icon)); |
| 94 | 91 |
| 95 if (chrome::IsRunningInMash()) | 92 if (chrome::IsRunningInMash()) |
| 96 ui_window_tracker_->Add(aura::GetMusWindow(window)); | 93 ui_window_tracker_->Add(aura::GetMusWindow(window)); |
| 97 else | 94 else |
| 98 aura_window_tracker_->Add(window); | 95 aura_window_tracker_->Add(window); |
| 99 } | 96 } |
| OLD | NEW |