| OLD | NEW |
| 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 "content/shell/shell.h" | 5 #include "content/shell/shell.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 const string16& message, | 217 const string16& message, |
| 218 int32 line_no, | 218 int32 line_no, |
| 219 const string16& source_id) { | 219 const string16& source_id) { |
| 220 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 220 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 221 return false; | 221 return false; |
| 222 | 222 |
| 223 std::string buffer("CONSOLE MESSAGE: "); | 223 std::string buffer("CONSOLE MESSAGE: "); |
| 224 if (line_no) | 224 if (line_no) |
| 225 buffer += base::StringPrintf("line %d: ", line_no); | 225 buffer += base::StringPrintf("line %d: ", line_no); |
| 226 buffer += UTF16ToUTF8(message); | 226 buffer += UTF16ToUTF8(message); |
| 227 WebKitTestController::Get()->printer().AddMessage(buffer); | 227 WebKitTestController::Get()->printer()->AddMessage(buffer); |
| 228 return true; | 228 return true; |
| 229 } | 229 } |
| 230 | 230 |
| 231 void Shell::RendererUnresponsive(WebContents* source) { | 231 void Shell::RendererUnresponsive(WebContents* source) { |
| 232 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 232 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 233 return; | 233 return; |
| 234 WebKitTestController::Get()->RendererUnresponsive(); | 234 WebKitTestController::Get()->RendererUnresponsive(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void Shell::Observe(int type, | 237 void Shell::Observe(int type, |
| 238 const NotificationSource& source, | 238 const NotificationSource& source, |
| 239 const NotificationDetails& details) { | 239 const NotificationDetails& details) { |
| 240 if (type == NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED) { | 240 if (type == NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED) { |
| 241 std::pair<NavigationEntry*, bool>* title = | 241 std::pair<NavigationEntry*, bool>* title = |
| 242 Details<std::pair<NavigationEntry*, bool> >(details).ptr(); | 242 Details<std::pair<NavigationEntry*, bool> >(details).ptr(); |
| 243 | 243 |
| 244 if (title->first) { | 244 if (title->first) { |
| 245 string16 text = title->first->GetTitle(); | 245 string16 text = title->first->GetTitle(); |
| 246 PlatformSetTitle(text); | 246 PlatformSetTitle(text); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace content | 251 } // namespace content |
| OLD | NEW |