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/chrome_mash_shelf_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
8 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 8 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "chrome/grit/theme_resources.h" | 10 #include "chrome/grit/theme_resources.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 DCHECK(!instance_); | 52 DCHECK(!instance_); |
53 instance_ = new ChromeMashShelfController(); | 53 instance_ = new ChromeMashShelfController(); |
54 instance_->Init(); | 54 instance_->Init(); |
55 return instance_; | 55 return instance_; |
56 } | 56 } |
57 | 57 |
58 ChromeMashShelfController::ChromeMashShelfController() | 58 ChromeMashShelfController::ChromeMashShelfController() |
59 : observer_binding_(this) {} | 59 : observer_binding_(this) {} |
60 | 60 |
61 void ChromeMashShelfController::Init() { | 61 void ChromeMashShelfController::Init() { |
62 mojo::Connector* connector = | 62 shell::Connector* connector = |
63 content::MojoShellConnection::Get()->GetConnector(); | 63 content::MojoShellConnection::Get()->GetConnector(); |
64 connector->ConnectToInterface("mojo:ash_sysui", &shelf_controller_); | 64 connector->ConnectToInterface("mojo:ash_sysui", &shelf_controller_); |
65 | 65 |
66 // Set shelf alignment and auto-hide behavior from preferences. | 66 // Set shelf alignment and auto-hide behavior from preferences. |
67 Profile* profile = ProfileManager::GetActiveUserProfile(); | 67 Profile* profile = ProfileManager::GetActiveUserProfile(); |
68 | 68 |
69 const std::string& alignment_value = | 69 const std::string& alignment_value = |
70 profile->GetPrefs()->GetString(prefs::kShelfAlignmentLocal); | 70 profile->GetPrefs()->GetString(prefs::kShelfAlignmentLocal); |
71 shelf_controller_->SetAlignment(static_cast<mash::shelf::mojom::Alignment>( | 71 shelf_controller_->SetAlignment(static_cast<mash::shelf::mojom::Alignment>( |
72 ash::AlignmentFromPref(alignment_value))); | 72 ash::AlignmentFromPref(alignment_value))); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 void ChromeMashShelfController::OnAutoHideBehaviorChanged( | 108 void ChromeMashShelfController::OnAutoHideBehaviorChanged( |
109 mash::shelf::mojom::AutoHideBehavior auto_hide) { | 109 mash::shelf::mojom::AutoHideBehavior auto_hide) { |
110 const char* value = ash::AutoHideBehaviorToPref( | 110 const char* value = ash::AutoHideBehaviorToPref( |
111 static_cast<ash::ShelfAutoHideBehavior>(auto_hide)); | 111 static_cast<ash::ShelfAutoHideBehavior>(auto_hide)); |
112 if (!value) | 112 if (!value) |
113 return; | 113 return; |
114 Profile* profile = ProfileManager::GetActiveUserProfile(); | 114 Profile* profile = ProfileManager::GetActiveUserProfile(); |
115 profile->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 115 profile->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); |
116 } | 116 } |
OLD | NEW |