OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 | 593 |
594 bool DeleteEntryRequest::didDeleteEntry() | 594 bool DeleteEntryRequest::didDeleteEntry() |
595 { | 595 { |
596 reportResult(static_cast<FileError::ErrorCode>(0)); | 596 reportResult(static_cast<FileError::ErrorCode>(0)); |
597 return true; | 597 return true; |
598 } | 598 } |
599 | 599 |
600 } // anonymous namespace | 600 } // anonymous namespace |
601 | 601 |
602 // static | 602 // static |
603 PassOwnPtr<InspectorFileSystemAgent> InspectorFileSystemAgent::create(Instrument
ingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorComposit
eState* state) | 603 PassRefPtr<InspectorFileSystemAgent> InspectorFileSystemAgent::create(Instrument
ingAgents* instrumentingAgents, InspectorState* state, PassRefPtr<InspectorPageA
gent> pageAgent) |
604 { | 604 { |
605 return adoptPtr(new InspectorFileSystemAgent(instrumentingAgents, pageAgent,
state)); | 605 return adoptRef(new InspectorFileSystemAgent(instrumentingAgents, state, pag
eAgent)); |
606 } | 606 } |
607 | 607 |
608 InspectorFileSystemAgent::~InspectorFileSystemAgent() | 608 InspectorFileSystemAgent::~InspectorFileSystemAgent() |
609 { | 609 { |
610 } | 610 } |
611 | 611 |
612 void InspectorFileSystemAgent::enable(ErrorString*) | 612 void InspectorFileSystemAgent::enable(ErrorString*) |
613 { | 613 { |
614 if (m_enabled) | 614 if (m_enabled) |
615 return; | 615 return; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 { | 693 { |
694 m_enabled = false; | 694 m_enabled = false; |
695 m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled)
; | 695 m_state->setBoolean(FileSystemAgentState::fileSystemAgentEnabled, m_enabled)
; |
696 } | 696 } |
697 | 697 |
698 void InspectorFileSystemAgent::restore() | 698 void InspectorFileSystemAgent::restore() |
699 { | 699 { |
700 m_enabled = m_state->getBoolean(FileSystemAgentState::fileSystemAgentEnabled
); | 700 m_enabled = m_state->getBoolean(FileSystemAgentState::fileSystemAgentEnabled
); |
701 } | 701 } |
702 | 702 |
703 InspectorFileSystemAgent::InspectorFileSystemAgent(InstrumentingAgents* instrume
ntingAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* state) | 703 InspectorFileSystemAgent::InspectorFileSystemAgent(InstrumentingAgents* instrume
ntingAgents, InspectorState* state, PassRefPtr<InspectorPageAgent> pageAgent) |
704 : InspectorBaseAgent<InspectorFileSystemAgent>("FileSystem", instrumentingAg
ents, state) | 704 : InspectorBaseAgent(instrumentingAgents, state) |
705 , m_pageAgent(pageAgent) | 705 , m_pageAgent(pageAgent) |
706 , m_enabled(false) | 706 , m_enabled(false) |
707 { | 707 { |
708 ASSERT(instrumentingAgents); | 708 ASSERT(instrumentingAgents); |
709 ASSERT(state); | 709 ASSERT(state); |
710 ASSERT(m_pageAgent); | 710 ASSERT(m_pageAgent); |
711 } | 711 } |
712 | 712 |
713 bool InspectorFileSystemAgent::assertEnabled(ErrorString* error) | 713 bool InspectorFileSystemAgent::assertEnabled(ErrorString* error) |
714 { | 714 { |
715 if (!m_enabled) { | 715 if (!m_enabled) { |
716 *error = "FileSystem agent is not enabled."; | 716 *error = "FileSystem agent is not enabled."; |
717 return false; | 717 return false; |
718 } | 718 } |
719 return true; | 719 return true; |
720 } | 720 } |
721 | 721 |
722 ScriptExecutionContext* InspectorFileSystemAgent::assertScriptExecutionContextFo
rOrigin(ErrorString* error, SecurityOrigin* origin) | 722 ScriptExecutionContext* InspectorFileSystemAgent::assertScriptExecutionContextFo
rOrigin(ErrorString* error, SecurityOrigin* origin) |
723 { | 723 { |
724 for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree()->
traverseNext()) { | 724 for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree()->
traverseNext()) { |
725 if (frame->document() && frame->document()->securityOrigin()->isSameSche
meHostPort(origin)) | 725 if (frame->document() && frame->document()->securityOrigin()->isSameSche
meHostPort(origin)) |
726 return frame->document(); | 726 return frame->document(); |
727 } | 727 } |
728 | 728 |
729 *error = "No frame is available for the request"; | 729 *error = "No frame is available for the request"; |
730 return 0; | 730 return 0; |
731 } | 731 } |
732 | 732 |
| 733 InspectorFileSystemController::InspectorFileSystemController(InstrumentingAgents
* instrumentingAgents, InspectorCompositeState* compositeState, InspectorPageCon
troller* pageController) |
| 734 : InspectorBaseController<InspectorFileSystemController, InspectorFileSystem
Agent>("FileSystem", instrumentingAgents, compositeState) |
| 735 { |
| 736 setAgent(InspectorFileSystemAgent::create(m_instrumentingAgents, m_state, pa
geController->getAgent())); |
| 737 } |
| 738 |
733 } // namespace WebCore | 739 } // namespace WebCore |
OLD | NEW |