OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webui/options/supervised_user_create_confirm_handler
.h" | 5 #include "chrome/browser/ui/webui/options/supervised_user_create_confirm_handler
.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 DCHECK(create_confirm_handler_); | 47 DCHECK(create_confirm_handler_); |
48 scoped_observer_.Add(profile_attributes_storage_); | 48 scoped_observer_.Add(profile_attributes_storage_); |
49 } | 49 } |
50 | 50 |
51 private: | 51 private: |
52 // ProfileAttributesStorage::Observer implementation: | 52 // ProfileAttributesStorage::Observer implementation: |
53 // Forward possibly relevant changes to the dialog, which will check the | 53 // Forward possibly relevant changes to the dialog, which will check the |
54 // affected profile and update or close as needed. | 54 // affected profile and update or close as needed. |
55 void OnProfileWasRemoved(const base::FilePath& profile_path, | 55 void OnProfileWasRemoved(const base::FilePath& profile_path, |
56 const base::string16& profile_name) override { | 56 const base::string16& profile_name) override { |
57 scoped_ptr<base::StringValue> profile_path_value( | 57 std::unique_ptr<base::StringValue> profile_path_value( |
58 base::CreateFilePathValue(profile_path)); | 58 base::CreateFilePathValue(profile_path)); |
59 create_confirm_handler_->web_ui()->CallJavascriptFunction( | 59 create_confirm_handler_->web_ui()->CallJavascriptFunction( |
60 "SupervisedUserCreateConfirmOverlay.onDeletedProfile", | 60 "SupervisedUserCreateConfirmOverlay.onDeletedProfile", |
61 *profile_path_value); | 61 *profile_path_value); |
62 } | 62 } |
63 | 63 |
64 void OnProfileNameChanged(const base::FilePath& profile_path, | 64 void OnProfileNameChanged(const base::FilePath& profile_path, |
65 const base::string16& old_profile_name) override { | 65 const base::string16& old_profile_name) override { |
66 ProfileAttributesEntry* entry; | 66 ProfileAttributesEntry* entry; |
67 if (!profile_attributes_storage_-> | 67 if (!profile_attributes_storage_-> |
68 GetProfileAttributesWithPath(profile_path, &entry)) | 68 GetProfileAttributesWithPath(profile_path, &entry)) |
69 return; | 69 return; |
70 base::string16 new_profile_name = entry->GetName(); | 70 base::string16 new_profile_name = entry->GetName(); |
71 scoped_ptr<base::StringValue> profile_path_value( | 71 std::unique_ptr<base::StringValue> profile_path_value( |
72 base::CreateFilePathValue(profile_path)); | 72 base::CreateFilePathValue(profile_path)); |
73 create_confirm_handler_->web_ui()->CallJavascriptFunction( | 73 create_confirm_handler_->web_ui()->CallJavascriptFunction( |
74 "SupervisedUserCreateConfirmOverlay.onUpdatedProfileName", | 74 "SupervisedUserCreateConfirmOverlay.onUpdatedProfileName", |
75 *profile_path_value, | 75 *profile_path_value, |
76 base::StringValue(new_profile_name)); | 76 base::StringValue(new_profile_name)); |
77 } | 77 } |
78 | 78 |
79 // Weak. | 79 // Weak. |
80 ProfileAttributesStorage* profile_attributes_storage_; | 80 ProfileAttributesStorage* profile_attributes_storage_; |
81 | 81 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 Profile* profile = g_browser_process->profile_manager()-> | 160 Profile* profile = g_browser_process->profile_manager()-> |
161 GetProfileByPath(profile_file_path); | 161 GetProfileByPath(profile_file_path); |
162 DCHECK(profile); | 162 DCHECK(profile); |
163 | 163 |
164 profiles::FindOrCreateNewWindowForProfile( | 164 profiles::FindOrCreateNewWindowForProfile( |
165 profile, chrome::startup::IS_PROCESS_STARTUP, | 165 profile, chrome::startup::IS_PROCESS_STARTUP, |
166 chrome::startup::IS_FIRST_RUN, false); | 166 chrome::startup::IS_FIRST_RUN, false); |
167 } | 167 } |
168 | 168 |
169 } // namespace options | 169 } // namespace options |
OLD | NEW |