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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 chrome::SettingsWindowManager::GetInstance()->AddObserver(this); | 45 chrome::SettingsWindowManager::GetInstance()->AddObserver(this); |
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. | |
56 static constexpr const char kSettingsAppID[] = "Settings"; | |
James Cook
2017/05/04 16:38:49
Are all of "static constexpr const" needed here?
msw
2017/05/04 19:05:58
Done.
| |
57 window->SetProperty(ash::kShelfIDKey, new ash::ShelfID(kSettingsAppID)); | |
55 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); | 58 window->SetProperty<int>(ash::kShelfItemTypeKey, ash::TYPE_DIALOG); |
56 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 59 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
57 // The new gfx::ImageSkia instance is owned by the window itself. | 60 // The new gfx::ImageSkia instance is owned by the window itself. |
58 window->SetProperty( | 61 window->SetProperty( |
59 aura::client::kWindowIconKey, | 62 aura::client::kWindowIconKey, |
60 new gfx::ImageSkia(*rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_SETTINGS))); | 63 new gfx::ImageSkia(*rb.GetImageSkiaNamed(IDR_ASH_SHELF_ICON_SETTINGS))); |
61 aura_window_tracker_->Add(window); | 64 aura_window_tracker_->Add(window); |
62 } | 65 } |
OLD | NEW |