1 // Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights 2 // reserved. Use of this source code is governed by a BSD-style license that 3 // can be found in the LICENSE file. 4 5 #ifndef CEF_LIBCEF_COMMON_PROCESS_MESSAGE_IMPL_H_ 6 #define CEF_LIBCEF_COMMON_PROCESS_MESSAGE_IMPL_H_ 7 #pragma once 8 9 #include "include/cef_process_message.h" 10 11 namespace base { 12 class ListValue; 13 } 14 15 // CefProcessMessage implementation. 16 class CefProcessMessageImpl : public CefProcessMessage { 17 public: 18 // Constructor for referencing existing |arguments|. 19 CefProcessMessageImpl(const CefString& name, 20 CefRefPtr<CefListValue> arguments); 21 22 // Constructor for creating a new CefListValue that takes ownership of 23 // |arguments|. 24 CefProcessMessageImpl(const CefString& name, 25 base::ListValue arguments, 26 bool read_only); 27 28 CefProcessMessageImpl(const CefProcessMessageImpl&) = delete; 29 CefProcessMessageImpl& operator=(const CefProcessMessageImpl&) = delete; 30 31 ~CefProcessMessageImpl() override; 32 33 // Transfer ownership of the underlying argument list to the caller, or create 34 // a copy if the argument list is already owned by something else. 35 // TODO: Pass by reference instead of ownership if/when Mojo adds support 36 // for that. 37 base::ListValue TakeArgumentList() WARN_UNUSED_RESULT; 38 39 // CefProcessMessage methods. 40 bool IsValid() override; 41 bool IsReadOnly() override; 42 CefRefPtr<CefProcessMessage> Copy() override; 43 CefString GetName() override; 44 CefRefPtr<CefListValue> GetArgumentList() override; 45 46 private: 47 const CefString name_; 48 CefRefPtr<CefListValue> arguments_; 49 50 IMPLEMENT_REFCOUNTING(CefProcessMessageImpl); 51 }; 52 53 #endif // CEF_LIBCEF_COMMON_PROCESS_MESSAGE_IMPL_H_ 54