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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Generated as crx_file::id_util::GenerateId("org.chromium.settings_ui") | 56 // Generated as crx_file::id_util::GenerateId("org.chromium.settings_ui") |
57 static constexpr char kSettingsId[] = "dhnmfjegnohoakobpikffnelcemaplkm"; | 57 static constexpr char kSettingsId[] = "dhnmfjegnohoakobpikffnelcemaplkm"; |
58 window->SetProperty(ash::kShelfIDKey, new ash::ShelfID(kSettingsId)); | 58 const ash::ShelfID shelf_id(kSettingsId); |
| 59 window->SetProperty(ash::kShelfIDKey, new std::string(shelf_id.Serialize())); |
59 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); | 60 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); |
60 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 61 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
61 // The new gfx::ImageSkia instance is owned by the window itself. | 62 // The new gfx::ImageSkia instance is owned by the window itself. |
62 window->SetProperty( | 63 window->SetProperty( |
63 aura::client::kWindowIconKey, | 64 aura::client::kWindowIconKey, |
64 new gfx::ImageSkia(*rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_SETTINGS))); | 65 new gfx::ImageSkia(*rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_SETTINGS))); |
65 aura_window_tracker_->Add(window); | 66 aura_window_tracker_->Add(window); |
66 } | 67 } |
OLD | NEW |