| 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/public/cpp/shelf_item.h" | 7 #include "ash/public/cpp/shelf_item.h" |
| 8 #include "ash/public/cpp/window_properties.h" | 8 #include "ash/public/cpp/window_properties.h" |
| 9 #include "ash/resources/grit/ash_resources.h" | 9 #include "ash/resources/grit/ash_resources.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 SettingsWindowObserver::~SettingsWindowObserver() { | 48 SettingsWindowObserver::~SettingsWindowObserver() { |
| 49 chrome::SettingsWindowManager::GetInstance()->RemoveObserver(this); | 49 chrome::SettingsWindowManager::GetInstance()->RemoveObserver(this); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void SettingsWindowObserver::OnNewSettingsWindow(Browser* settings_browser) { | 52 void SettingsWindowObserver::OnNewSettingsWindow(Browser* settings_browser) { |
| 53 aura::Window* window = settings_browser->window()->GetNativeWindow(); | 53 aura::Window* window = settings_browser->window()->GetNativeWindow(); |
| 54 window->SetTitle(l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); | 54 window->SetTitle(l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE)); |
| 55 // An app id for settings windows, also used to identify the shelf item. | 55 // An app id for settings windows, also used to identify the shelf item. |
| 56 static constexpr char kSettingsId[] = "SettingsId"; | 56 // Generated as crx_file::id_util::GenerateId("org.chromium.settings_ui") |
| 57 static constexpr char kSettingsId[] = "dhnmfjegnohoakobpikffnelcemaplkm"; |
| 57 window->SetProperty(ash::kShelfIDKey, new ash::ShelfID(kSettingsId)); | 58 window->SetProperty(ash::kShelfIDKey, new ash::ShelfID(kSettingsId)); |
| 58 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); | 59 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); |
| 59 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 60 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 60 // The new gfx::ImageSkia instance is owned by the window itself. | 61 // The new gfx::ImageSkia instance is owned by the window itself. |
| 61 window->SetProperty( | 62 window->SetProperty( |
| 62 aura::client::kWindowIconKey, | 63 aura::client::kWindowIconKey, |
| 63 new gfx::ImageSkia(*rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_SETTINGS))); | 64 new gfx::ImageSkia(*rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_SETTINGS))); |
| 64 aura_window_tracker_->Add(window); | 65 aura_window_tracker_->Add(window); |
| 65 } | 66 } |
| OLD | NEW |