Commit fb889f37 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Clean up browser_window_property_manager_win.cc,h

Miscellaneous cleanup, no functional changes.

Change-Id: I45b63c7f9a71e9166ed0178f119aeb1a9f7311e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350839
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797212}
parent dcd71cdf
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
using extensions::ExtensionRegistry; using extensions::ExtensionRegistry;
BrowserWindowPropertyManager::BrowserWindowPropertyManager(BrowserView* view, BrowserWindowPropertyManager::BrowserWindowPropertyManager(
const BrowserView* view,
HWND hwnd) HWND hwnd)
: view_(view), : view_(view), hwnd_(hwnd) {
hwnd_(hwnd) {
// At this point, the HWND is unavailable from BrowserView. // At this point, the HWND is unavailable from BrowserView.
DCHECK(hwnd); DCHECK(hwnd);
profile_pref_registrar_.Init(view_->browser()->profile()->GetPrefs()); profile_pref_registrar_.Init(view_->browser()->profile()->GetPrefs());
...@@ -45,7 +45,7 @@ BrowserWindowPropertyManager::~BrowserWindowPropertyManager() { ...@@ -45,7 +45,7 @@ BrowserWindowPropertyManager::~BrowserWindowPropertyManager() {
} }
void BrowserWindowPropertyManager::UpdateWindowProperties() { void BrowserWindowPropertyManager::UpdateWindowProperties() {
Browser* browser = view_->browser(); const Browser* browser = view_->browser();
Profile* profile = browser->profile(); Profile* profile = browser->profile();
// Set the app user model id for this application to that of the application // Set the app user model id for this application to that of the application
...@@ -56,12 +56,6 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() { ...@@ -56,12 +56,6 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() {
base::UTF8ToWide(browser->app_name()), profile->GetPath()) base::UTF8ToWide(browser->app_name()), profile->GetPath())
: shell_integration::win::GetChromiumModelIdForProfile( : shell_integration::win::GetChromiumModelIdForProfile(
profile->GetPath()); profile->GetPath());
base::FilePath icon_path;
base::string16 command_line_string;
base::string16 pinned_name;
ProfileManager* profile_manager = g_browser_process->profile_manager();
ProfileShortcutManager* shortcut_manager = nullptr;
// Apps set their relaunch details based on app's details. // Apps set their relaunch details based on app's details.
if (browser->deprecated_is_app()) { if (browser->deprecated_is_app()) {
ExtensionRegistry* registry = ExtensionRegistry::Get(profile); ExtensionRegistry* registry = ExtensionRegistry::Get(profile);
...@@ -75,17 +69,20 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() { ...@@ -75,17 +69,20 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() {
} }
} }
ProfileManager* const profile_manager = g_browser_process->profile_manager();
ProfileShortcutManager* const shortcut_manager =
profile_manager ? profile_manager->profile_shortcut_manager() : nullptr;
// The profile manager may be null in testing. // The profile manager may be null in testing.
if (profile_manager)
shortcut_manager = profile_manager->profile_shortcut_manager();
base::FilePath icon_path;
base::string16 command_line_string;
base::string16 pinned_name;
if (!browser->deprecated_is_app() && shortcut_manager && if (!browser->deprecated_is_app() && shortcut_manager &&
profile->GetPrefs()->HasPrefPath(prefs::kProfileIconVersion)) { profile->GetPrefs()->HasPrefPath(prefs::kProfileIconVersion)) {
const base::FilePath& profile_path = profile->GetPath();
// Set relaunch details to use profile. // Set relaunch details to use profile.
base::CommandLine command_line(base::CommandLine::NO_PROGRAM); base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
shortcut_manager->GetShortcutProperties(profile_path, &command_line, shortcut_manager->GetShortcutProperties(profile->GetPath(), &command_line,
&pinned_name, &icon_path); &pinned_name, &icon_path);
command_line_string = command_line.GetCommandLineString(); command_line_string = command_line.GetCommandLineString();
} }
...@@ -96,7 +93,7 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() { ...@@ -96,7 +93,7 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() {
// static // static
std::unique_ptr<BrowserWindowPropertyManager> std::unique_ptr<BrowserWindowPropertyManager>
BrowserWindowPropertyManager::CreateBrowserWindowPropertyManager( BrowserWindowPropertyManager::CreateBrowserWindowPropertyManager(
BrowserView* view, const BrowserView* view,
HWND hwnd) { HWND hwnd) {
std::unique_ptr<BrowserWindowPropertyManager> browser_window_property_manager( std::unique_ptr<BrowserWindowPropertyManager> browser_window_property_manager(
new BrowserWindowPropertyManager(view, hwnd)); new BrowserWindowPropertyManager(view, hwnd));
......
...@@ -12,26 +12,28 @@ ...@@ -12,26 +12,28 @@
class BrowserView; class BrowserView;
// This class is resposible for updating the app id and relaunch details of a // This class is responsible for updating the app id and relaunch details of a
// browser frame. // browser frame.
class BrowserWindowPropertyManager { class BrowserWindowPropertyManager {
public: public:
BrowserWindowPropertyManager(const BrowserWindowPropertyManager&) = delete;
BrowserWindowPropertyManager& operator=(const BrowserWindowPropertyManager&) =
delete;
virtual ~BrowserWindowPropertyManager(); virtual ~BrowserWindowPropertyManager();
static std::unique_ptr<BrowserWindowPropertyManager> static std::unique_ptr<BrowserWindowPropertyManager>
CreateBrowserWindowPropertyManager(BrowserView* view, HWND hwnd); CreateBrowserWindowPropertyManager(const BrowserView* view, HWND hwnd);
private: private:
BrowserWindowPropertyManager(BrowserView* view, HWND hwnd); BrowserWindowPropertyManager(const BrowserView* view, HWND hwnd);
void UpdateWindowProperties(); void UpdateWindowProperties();
void OnProfileIconVersionChange(); void OnProfileIconVersionChange();
PrefChangeRegistrar profile_pref_registrar_; PrefChangeRegistrar profile_pref_registrar_;
BrowserView* view_; const BrowserView* view_;
const HWND hwnd_; const HWND hwnd_;
DISALLOW_COPY_AND_ASSIGN(BrowserWindowPropertyManager);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_WINDOW_PROPERTY_MANAGER_WIN_H_ #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_WINDOW_PROPERTY_MANAGER_WIN_H_
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