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

Side by Side Diff: chrome/browser/ui/webui/password_manager_internals/password_manager_internals_ui.cc

Issue 235623002: Password manager internals page: Improve security (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: innerHTML -> innerText Created 6 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 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/password_manager_internals/password_manager_in ternals_ui.h" 5 #include "chrome/browser/ui/webui/password_manager_internals/password_manager_in ternals_ui.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 13 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/android/tab_model/tab_model.h" 15 #include "chrome/browser/ui/android/tab_model/tab_model.h"
16 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" 16 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "content/public/browser/browser_context.h" 19 #include "content/public/browser/browser_context.h"
20 #include "content/public/browser/render_view_host.h" 20 #include "content/public/browser/render_view_host.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "content/public/browser/web_ui.h" 22 #include "content/public/browser/web_ui.h"
23 #include "content/public/browser/web_ui_data_source.h" 23 #include "content/public/browser/web_ui_data_source.h"
24 #include "grit/password_manager_internals_resources.h" 24 #include "grit/password_manager_internals_resources.h"
25 #include "net/base/escape.h"
25 26
26 using content::BrowserContext; 27 using content::BrowserContext;
27 using content::WebContents; 28 using content::WebContents;
28 29
29 namespace { 30 namespace {
30 31
31 content::WebUIDataSource* CreatePasswordManagerInternalsHTMLSource() { 32 content::WebUIDataSource* CreatePasswordManagerInternalsHTMLSource() {
32 content::WebUIDataSource* source = content::WebUIDataSource::Create( 33 content::WebUIDataSource* source = content::WebUIDataSource::Create(
33 chrome::kChromeUIPasswordManagerInternalsHost); 34 chrome::kChromeUIPasswordManagerInternalsHost);
34 35
(...skipping 24 matching lines...) Expand all
59 CreatePasswordManagerInternalsHTMLSource()); 60 CreatePasswordManagerInternalsHTMLSource());
60 NotifyAllPasswordManagerClients(PAGE_OPENED); 61 NotifyAllPasswordManagerClients(PAGE_OPENED);
61 } 62 }
62 63
63 PasswordManagerInternalsUI::~PasswordManagerInternalsUI() { 64 PasswordManagerInternalsUI::~PasswordManagerInternalsUI() {
64 NotifyAllPasswordManagerClients(PAGE_CLOSED); 65 NotifyAllPasswordManagerClients(PAGE_CLOSED);
65 } 66 }
66 67
67 void PasswordManagerInternalsUI::LogSavePasswordProgress( 68 void PasswordManagerInternalsUI::LogSavePasswordProgress(
68 const std::string& text) { 69 const std::string& text) {
69 base::StringValue text_string_value(text); 70 base::StringValue text_string_value(net::EscapeForHTML(text));
70 web_ui()->CallJavascriptFunction("addSavePasswordProgressLog", 71 web_ui()->CallJavascriptFunction("addSavePasswordProgressLog",
71 text_string_value); 72 text_string_value);
72 } 73 }
73 74
74 void PasswordManagerInternalsUI::NotifyAllPasswordManagerClients( 75 void PasswordManagerInternalsUI::NotifyAllPasswordManagerClients(
75 ClientNotificationType notification_type) { 76 ClientNotificationType notification_type) {
76 // First, find all the WebContents objects of the current profile. 77 // First, find all the WebContents objects of the current profile.
77 Profile* current_profile = Profile::FromWebUI(web_ui()); 78 Profile* current_profile = Profile::FromWebUI(web_ui());
78 std::set<WebContents*> profile_web_contents; 79 std::set<WebContents*> profile_web_contents;
79 #if defined(OS_ANDROID) 80 #if defined(OS_ANDROID)
(...skipping 22 matching lines...) Expand all
102 switch (notification_type) { 103 switch (notification_type) {
103 case PAGE_OPENED: 104 case PAGE_OPENED:
104 client->SetLogger(this); 105 client->SetLogger(this);
105 break; 106 break;
106 case PAGE_CLOSED: 107 case PAGE_CLOSED:
107 client->SetLogger(NULL); 108 client->SetLogger(NULL);
108 break; 109 break;
109 } 110 }
110 } 111 }
111 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698