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

Side by Side Diff: sky/engine/core/frame/FrameConsole.cpp

Issue 1239633002: Remove //sky/engine/platform/network (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years, 5 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
« no previous file with comments | « sky/engine/core/frame/FrameConsole.h ('k') | sky/engine/core/loader/EmptyClients.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "sky/engine/core/frame/FrameConsole.h" 29 #include "sky/engine/core/frame/FrameConsole.h"
30 30
31 #include "sky/engine/core/dom/Document.h" 31 #include "sky/engine/core/dom/Document.h"
32 #include "sky/engine/core/frame/FrameHost.h" 32 #include "sky/engine/core/frame/FrameHost.h"
33 #include "sky/engine/core/inspector/ConsoleAPITypes.h" 33 #include "sky/engine/core/inspector/ConsoleAPITypes.h"
34 #include "sky/engine/core/inspector/ConsoleMessage.h" 34 #include "sky/engine/core/inspector/ConsoleMessage.h"
35 #include "sky/engine/core/page/ChromeClient.h" 35 #include "sky/engine/core/page/ChromeClient.h"
36 #include "sky/engine/core/page/Page.h" 36 #include "sky/engine/core/page/Page.h"
37 #include "sky/engine/platform/network/ResourceResponse.h"
38 #include "sky/engine/wtf/text/StringBuilder.h" 37 #include "sky/engine/wtf/text/StringBuilder.h"
39 38
40 namespace blink { 39 namespace blink {
41 40
42 FrameConsole::FrameConsole(LocalFrame& frame) 41 FrameConsole::FrameConsole(LocalFrame& frame)
43 : m_frame(frame) 42 : m_frame(frame)
44 { 43 {
45 } 44 }
46 45
47 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(FrameConsole); 46 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(FrameConsole);
48 47
49 void FrameConsole::addMessage(PassRefPtr<ConsoleMessage> prpConsoleMessage) 48 void FrameConsole::addMessage(PassRefPtr<ConsoleMessage> prpConsoleMessage)
50 { 49 {
51 RefPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; 50 RefPtr<ConsoleMessage> consoleMessage = prpConsoleMessage;
52 51
53 // FIXME: This should not need to reach for the main-frame. 52 // FIXME: This should not need to reach for the main-frame.
54 // Inspector code should just take the current frame and know how to walk it self. 53 // Inspector code should just take the current frame and know how to walk it self.
55 ExecutionContext* context = m_frame.document(); 54 ExecutionContext* context = m_frame.document();
56 if (!context) 55 if (!context)
57 return; 56 return;
58 57
59 String messageURL = consoleMessage->url(); 58 String messageURL = consoleMessage->url();
60 unsigned lineNumber = consoleMessage->lineNumber(); 59 unsigned lineNumber = consoleMessage->lineNumber();
61 m_frame.page()->addMessageToConsole(&m_frame, consoleMessage->source(), cons oleMessage->level(), consoleMessage->message(), lineNumber, messageURL, String() ); 60 m_frame.page()->addMessageToConsole(&m_frame, consoleMessage->source(), cons oleMessage->level(), consoleMessage->message(), lineNumber, messageURL, String() );
62 } 61 }
63 62
64 void FrameConsole::reportResourceResponseReceived(Document* document, unsigned l ong requestIdentifier, const ResourceResponse& response)
65 {
66 if (!document)
67 return;
68 if (response.httpStatusCode() < 400)
69 return;
70 String message = "Failed to load resource: the server responded with a statu s of " + String::number(response.httpStatusCode()) + " (" + response.httpStatusT ext() + ')';
71 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(NetworkMessag eSource, ErrorMessageLevel, message, response.url().string());
72 consoleMessage->setRequestIdentifier(requestIdentifier);
73 addMessage(consoleMessage.release());
74 }
75
76 } // namespace blink 63 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/frame/FrameConsole.h ('k') | sky/engine/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698