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

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 105193002: Replace string16 with base::string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/devtools/devtools_window.h" 5 #include "chrome/browser/devtools/devtools_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 // DevToolsConfirmInfoBarDelegate --------------------------------------------- 75 // DevToolsConfirmInfoBarDelegate ---------------------------------------------
76 76
77 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { 77 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
78 public: 78 public:
79 // If |infobar_service| is NULL, runs |callback| with a single argument with 79 // If |infobar_service| is NULL, runs |callback| with a single argument with
80 // value "false". Otherwise, creates a dev tools confirm infobar and delegate 80 // value "false". Otherwise, creates a dev tools confirm infobar and delegate
81 // and adds the inofbar to |infobar_service|. 81 // and adds the inofbar to |infobar_service|.
82 static void Create(InfoBarService* infobar_service, 82 static void Create(InfoBarService* infobar_service,
83 const DevToolsWindow::InfoBarCallback& callback, 83 const DevToolsWindow::InfoBarCallback& callback,
84 const string16& message); 84 const base::string16& message);
85 85
86 private: 86 private:
87 DevToolsConfirmInfoBarDelegate( 87 DevToolsConfirmInfoBarDelegate(
88 InfoBarService* infobar_service, 88 InfoBarService* infobar_service,
89 const DevToolsWindow::InfoBarCallback& callback, 89 const DevToolsWindow::InfoBarCallback& callback,
90 const string16& message); 90 const base::string16& message);
91 virtual ~DevToolsConfirmInfoBarDelegate(); 91 virtual ~DevToolsConfirmInfoBarDelegate();
92 92
93 virtual string16 GetMessageText() const OVERRIDE; 93 virtual base::string16 GetMessageText() const OVERRIDE;
94 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 94 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
95 virtual bool Accept() OVERRIDE; 95 virtual bool Accept() OVERRIDE;
96 virtual bool Cancel() OVERRIDE; 96 virtual bool Cancel() OVERRIDE;
97 97
98 DevToolsWindow::InfoBarCallback callback_; 98 DevToolsWindow::InfoBarCallback callback_;
99 const string16 message_; 99 const base::string16 message_;
100 100
101 DISALLOW_COPY_AND_ASSIGN(DevToolsConfirmInfoBarDelegate); 101 DISALLOW_COPY_AND_ASSIGN(DevToolsConfirmInfoBarDelegate);
102 }; 102 };
103 103
104 void DevToolsConfirmInfoBarDelegate::Create( 104 void DevToolsConfirmInfoBarDelegate::Create(
105 InfoBarService* infobar_service, 105 InfoBarService* infobar_service,
106 const DevToolsWindow::InfoBarCallback& callback, 106 const DevToolsWindow::InfoBarCallback& callback,
107 const string16& message) { 107 const base::string16& message) {
108 if (!infobar_service) { 108 if (!infobar_service) {
109 callback.Run(false); 109 callback.Run(false);
110 return; 110 return;
111 } 111 }
112 112
113 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( 113 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
114 new DevToolsConfirmInfoBarDelegate(infobar_service, callback, message))); 114 new DevToolsConfirmInfoBarDelegate(infobar_service, callback, message)));
115 } 115 }
116 116
117 DevToolsConfirmInfoBarDelegate::DevToolsConfirmInfoBarDelegate( 117 DevToolsConfirmInfoBarDelegate::DevToolsConfirmInfoBarDelegate(
118 InfoBarService* infobar_service, 118 InfoBarService* infobar_service,
119 const DevToolsWindow::InfoBarCallback& callback, 119 const DevToolsWindow::InfoBarCallback& callback,
120 const string16& message) 120 const base::string16& message)
121 : ConfirmInfoBarDelegate(infobar_service), 121 : ConfirmInfoBarDelegate(infobar_service),
122 callback_(callback), 122 callback_(callback),
123 message_(message) { 123 message_(message) {
124 } 124 }
125 125
126 DevToolsConfirmInfoBarDelegate::~DevToolsConfirmInfoBarDelegate() { 126 DevToolsConfirmInfoBarDelegate::~DevToolsConfirmInfoBarDelegate() {
127 if (!callback_.is_null()) 127 if (!callback_.is_null())
128 callback_.Run(false); 128 callback_.Run(false);
129 } 129 }
130 130
131 string16 DevToolsConfirmInfoBarDelegate::GetMessageText() const { 131 base::string16 DevToolsConfirmInfoBarDelegate::GetMessageText() const {
132 return message_; 132 return message_;
133 } 133 }
134 134
135 string16 DevToolsConfirmInfoBarDelegate::GetButtonLabel( 135 base::string16 DevToolsConfirmInfoBarDelegate::GetButtonLabel(
136 InfoBarButton button) const { 136 InfoBarButton button) const {
137 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 137 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
138 IDS_DEV_TOOLS_CONFIRM_ALLOW_BUTTON : IDS_DEV_TOOLS_CONFIRM_DENY_BUTTON); 138 IDS_DEV_TOOLS_CONFIRM_ALLOW_BUTTON : IDS_DEV_TOOLS_CONFIRM_DENY_BUTTON);
139 } 139 }
140 140
141 bool DevToolsConfirmInfoBarDelegate::Accept() { 141 bool DevToolsConfirmInfoBarDelegate::Accept() {
142 callback_.Run(true); 142 callback_.Run(true);
143 callback_.Reset(); 143 callback_.Reset();
144 return true; 144 return true;
145 } 145 }
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 it != file_paths.end(); ++it) { 1293 it != file_paths.end(); ++it) {
1294 file_paths_value.AppendString(*it); 1294 file_paths_value.AppendString(*it);
1295 } 1295 }
1296 base::FundamentalValue request_id_value(request_id); 1296 base::FundamentalValue request_id_value(request_id);
1297 StringValue file_system_path_value(file_system_path); 1297 StringValue file_system_path_value(file_system_path);
1298 CallClientFunction("InspectorFrontendAPI.searchCompleted", &request_id_value, 1298 CallClientFunction("InspectorFrontendAPI.searchCompleted", &request_id_value,
1299 &file_system_path_value, &file_paths_value); 1299 &file_system_path_value, &file_paths_value);
1300 } 1300 }
1301 1301
1302 void DevToolsWindow::ShowDevToolsConfirmInfoBar( 1302 void DevToolsWindow::ShowDevToolsConfirmInfoBar(
1303 const string16& message, 1303 const base::string16& message,
1304 const InfoBarCallback& callback) { 1304 const InfoBarCallback& callback) {
1305 DevToolsConfirmInfoBarDelegate::Create( 1305 DevToolsConfirmInfoBarDelegate::Create(
1306 IsDocked() ? 1306 IsDocked() ?
1307 InfoBarService::FromWebContents(GetInspectedWebContents()) : 1307 InfoBarService::FromWebContents(GetInspectedWebContents()) :
1308 InfoBarService::FromWebContents(web_contents_), 1308 InfoBarService::FromWebContents(web_contents_),
1309 callback, message); 1309 callback, message);
1310 } 1310 }
1311 1311
1312 void DevToolsWindow::CreateDevToolsBrowser() { 1312 void DevToolsWindow::CreateDevToolsBrowser() {
1313 std::string wp_key = GetDevToolsWindowPlacementPrefKey(); 1313 std::string wp_key = GetDevToolsWindowPlacementPrefKey();
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 params.append(json); 1482 params.append(json);
1483 if (arg2) { 1483 if (arg2) {
1484 base::JSONWriter::Write(arg2, &json); 1484 base::JSONWriter::Write(arg2, &json);
1485 params.append(", " + json); 1485 params.append(", " + json);
1486 if (arg3) { 1486 if (arg3) {
1487 base::JSONWriter::Write(arg3, &json); 1487 base::JSONWriter::Write(arg3, &json);
1488 params.append(", " + json); 1488 params.append(", " + json);
1489 } 1489 }
1490 } 1490 }
1491 } 1491 }
1492 string16 javascript = ASCIIToUTF16(function_name + "(" + params + ");"); 1492 base::string16 javascript = ASCIIToUTF16(function_name + "(" + params + ");");
1493 web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame( 1493 web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
1494 base::string16(), javascript); 1494 base::string16(), javascript);
1495 } 1495 }
1496 1496
1497 void DevToolsWindow::UpdateBrowserToolbar() { 1497 void DevToolsWindow::UpdateBrowserToolbar() {
1498 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); 1498 BrowserWindow* inspected_window = GetInspectedBrowserWindow();
1499 if (inspected_window) 1499 if (inspected_window)
1500 inspected_window->UpdateToolbar(NULL); 1500 inspected_window->UpdateToolbar(NULL);
1501 } 1501 }
1502 1502
(...skipping 10 matching lines...) Expand all
1513 return inspected_contents_observer_ ? 1513 return inspected_contents_observer_ ?
1514 inspected_contents_observer_->web_contents() : NULL; 1514 inspected_contents_observer_->web_contents() : NULL;
1515 } 1515 }
1516 1516
1517 void DevToolsWindow::DocumentOnLoadCompletedInMainFrame() { 1517 void DevToolsWindow::DocumentOnLoadCompletedInMainFrame() {
1518 is_loaded_ = true; 1518 is_loaded_ = true;
1519 UpdateTheme(); 1519 UpdateTheme();
1520 DoAction(); 1520 DoAction();
1521 AddDevToolsExtensionsToClient(); 1521 AddDevToolsExtensionsToClient();
1522 } 1522 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/browser/diagnostics/diagnostics_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698