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 std::unique_ptr<base::StringValue> profile_path_value( | 57 std::unique_ptr<base::Value> profile_path_value( |
58 base::CreateFilePathValue(profile_path)); | 58 base::CreateFilePathValue(profile_path)); |
59 create_confirm_handler_->web_ui()->CallJavascriptFunctionUnsafe( | 59 create_confirm_handler_->web_ui()->CallJavascriptFunctionUnsafe( |
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 std::unique_ptr<base::StringValue> profile_path_value( | 71 std::unique_ptr<base::Value> profile_path_value( |
72 base::CreateFilePathValue(profile_path)); | 72 base::CreateFilePathValue(profile_path)); |
73 create_confirm_handler_->web_ui()->CallJavascriptFunctionUnsafe( | 73 create_confirm_handler_->web_ui()->CallJavascriptFunctionUnsafe( |
74 "SupervisedUserCreateConfirmOverlay.onUpdatedProfileName", | 74 "SupervisedUserCreateConfirmOverlay.onUpdatedProfileName", |
75 *profile_path_value, base::StringValue(new_profile_name)); | 75 *profile_path_value, base::Value(new_profile_name)); |
76 } | 76 } |
77 | 77 |
78 // Weak. | 78 // Weak. |
79 ProfileAttributesStorage* profile_attributes_storage_; | 79 ProfileAttributesStorage* profile_attributes_storage_; |
80 | 80 |
81 // Weak; owns us. | 81 // Weak; owns us. |
82 SupervisedUserCreateConfirmHandler* create_confirm_handler_; | 82 SupervisedUserCreateConfirmHandler* create_confirm_handler_; |
83 | 83 |
84 // Manages any sources we're observing, ensuring that they're all removed | 84 // Manages any sources we're observing, ensuring that they're all removed |
85 // on destruction. | 85 // on destruction. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 Profile* profile = g_browser_process->profile_manager()-> | 159 Profile* profile = g_browser_process->profile_manager()-> |
160 GetProfileByPath(profile_file_path); | 160 GetProfileByPath(profile_file_path); |
161 DCHECK(profile); | 161 DCHECK(profile); |
162 | 162 |
163 profiles::FindOrCreateNewWindowForProfile( | 163 profiles::FindOrCreateNewWindowForProfile( |
164 profile, chrome::startup::IS_PROCESS_STARTUP, | 164 profile, chrome::startup::IS_PROCESS_STARTUP, |
165 chrome::startup::IS_FIRST_RUN, false); | 165 chrome::startup::IS_FIRST_RUN, false); |
166 } | 166 } |
167 | 167 |
168 } // namespace options | 168 } // namespace options |
OLD | NEW |