9f328abe19
* add new native_mate converters for base::Value * fix converter swapping * remove createDeepCopy from browser/api * replace missing ListValue converter * convert bulk of remaining createDeepCopy instances * convert last remaining instances of createDeepCopy * incremental progress and helper methods for value conversion * convert Get and add template function for GetString * final DictionaryValue method conversions * remove usage of base::DictionaryValue in web_contents_preferences * use IsEnabled helper where possible * Update atom_api_web_view_manager.cc
34 lines
990 B
C++
34 lines
990 B
C++
// Copyright (c) 2016 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "atom/renderer/preferences_manager.h"
|
|
|
|
#include "atom/common/api/api_messages.h"
|
|
#include "content/public/renderer/render_thread.h"
|
|
|
|
namespace atom {
|
|
|
|
PreferencesManager::PreferencesManager() {
|
|
content::RenderThread::Get()->AddObserver(this);
|
|
}
|
|
|
|
PreferencesManager::~PreferencesManager() {}
|
|
|
|
bool PreferencesManager::OnControlMessageReceived(const IPC::Message& message) {
|
|
bool handled = true;
|
|
IPC_BEGIN_MESSAGE_MAP(PreferencesManager, message)
|
|
IPC_MESSAGE_HANDLER(AtomMsg_UpdatePreferences, OnUpdatePreferences)
|
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
|
IPC_END_MESSAGE_MAP()
|
|
return handled;
|
|
}
|
|
|
|
void PreferencesManager::OnUpdatePreferences(
|
|
const base::ListValue& preferences) {
|
|
auto copy =
|
|
base::ListValue::From(base::Value::ToUniquePtrValue(preferences.Clone()));
|
|
preferences_.swap(copy);
|
|
}
|
|
|
|
} // namespace atom
|