Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Side by Side Diff: chrome/browser/ui/webui/options2/manage_profile_handler2.cc

Issue 9994005: Separate handler initialization from page initialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move anything that indirectly calls JS to InitializePage Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/options2/manage_profile_handler2.h" 5 #include "chrome/browser/ui/webui/options2/manage_profile_handler2.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, 45 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE },
46 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, 46 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL },
47 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, 47 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE },
48 }; 48 };
49 49
50 RegisterStrings(localized_strings, resources, arraysize(resources)); 50 RegisterStrings(localized_strings, resources, arraysize(resources));
51 RegisterTitle(localized_strings, "manageProfile", 51 RegisterTitle(localized_strings, "manageProfile",
52 IDS_PROFILES_MANAGE_TITLE); 52 IDS_PROFILES_MANAGE_TITLE);
53 } 53 }
54 54
55 void ManageProfileHandler::InitializeHandler() { 55 void ManageProfileHandler::InitializePage() {
56 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 56 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
57 content::NotificationService::AllSources()); 57 content::NotificationService::AllSources());
58 }
59
60 void ManageProfileHandler::InitializePage() {
61 SendProfileNames(); 58 SendProfileNames();
62 } 59 }
63 60
64 void ManageProfileHandler::RegisterMessages() { 61 void ManageProfileHandler::RegisterMessages() {
65 web_ui()->RegisterMessageCallback("setProfileNameAndIcon", 62 web_ui()->RegisterMessageCallback("setProfileNameAndIcon",
66 base::Bind(&ManageProfileHandler::SetProfileNameAndIcon, 63 base::Bind(&ManageProfileHandler::SetProfileNameAndIcon,
67 base::Unretained(this))); 64 base::Unretained(this)));
68 web_ui()->RegisterMessageCallback("deleteProfile", 65 web_ui()->RegisterMessageCallback("deleteProfile",
69 base::Bind(&ManageProfileHandler::DeleteProfile, 66 base::Bind(&ManageProfileHandler::DeleteProfile,
70 base::Unretained(this))); 67 base::Unretained(this)));
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); 316 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i);
320 if (gaia_name.empty()) 317 if (gaia_name.empty())
321 return; 318 return;
322 319
323 StringValue gaia_name_value(gaia_name); 320 StringValue gaia_name_value(gaia_name);
324 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName", 321 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName",
325 gaia_name_value); 322 gaia_name_value);
326 } 323 }
327 324
328 } // namespace options2 325 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698