Use vector of dictionaries instead of mate::Arguments

This commit is contained in:
Kevin Sawicki 2017-02-28 16:14:02 -08:00
parent 98f5858b11
commit 823b3baed0
6 changed files with 15 additions and 14 deletions

View file

@ -849,8 +849,8 @@ void Window::DestroyTouchBar() {
window_->DestroyTouchBar(); window_->DestroyTouchBar();
} }
void Window::SetTouchBar(mate::Arguments* args) { void Window::SetTouchBar(const std::vector<mate::PersistentDictionary>& items) {
window_->SetTouchBar(args); window_->SetTouchBar(items);
} }
void Window::RefreshTouchBarItem(const std::string& item_id) { void Window::RefreshTouchBarItem(const std::string& item_id) {

View file

@ -16,6 +16,7 @@
#include "atom/common/api/atom_api_native_image.h" #include "atom/common/api/atom_api_native_image.h"
#include "atom/common/key_weak_map.h" #include "atom/common/key_weak_map.h"
#include "native_mate/handle.h" #include "native_mate/handle.h"
#include "native_mate/persistent_dictionary.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
class GURL; class GURL;
@ -206,7 +207,7 @@ class Window : public mate::TrackableObject<Window>,
void SetVibrancy(mate::Arguments* args); void SetVibrancy(mate::Arguments* args);
void DestroyTouchBar(); void DestroyTouchBar();
void SetTouchBar(mate::Arguments* args); void SetTouchBar(const std::vector<mate::PersistentDictionary>& items);
void RefreshTouchBarItem(const std::string& item_id); void RefreshTouchBarItem(const std::string& item_id);
v8::Local<v8::Value> WebContents(v8::Isolate* isolate); v8::Local<v8::Value> WebContents(v8::Isolate* isolate);

View file

@ -344,7 +344,8 @@ void NativeWindow::SetVibrancy(const std::string& filename) {
void NativeWindow::DestroyTouchBar() { void NativeWindow::DestroyTouchBar() {
} }
void NativeWindow::SetTouchBar(mate::Arguments* args) { void NativeWindow::SetTouchBar(
const std::vector<mate::PersistentDictionary>& items) {
} }
void NativeWindow::RefreshTouchBarItem(const std::string& item_id) { void NativeWindow::RefreshTouchBarItem(const std::string& item_id) {

View file

@ -22,6 +22,7 @@
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
#include "extensions/browser/app_window/size_constraints.h" #include "extensions/browser/app_window/size_constraints.h"
#include "native_mate/constructor.h" #include "native_mate/constructor.h"
#include "native_mate/persistent_dictionary.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
@ -172,7 +173,8 @@ class NativeWindow : public base::SupportsUserData,
// Touchbar API // Touchbar API
virtual void DestroyTouchBar(); virtual void DestroyTouchBar();
virtual void SetTouchBar(mate::Arguments* args); virtual void SetTouchBar(
const std::vector<mate::PersistentDictionary>& items);
virtual void RefreshTouchBarItem(const std::string& item_id); virtual void RefreshTouchBarItem(const std::string& item_id);
// Webview APIs. // Webview APIs.

View file

@ -13,8 +13,6 @@
#include "atom/browser/native_window.h" #include "atom/browser/native_window.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host.h"
#include "native_mate/constructor.h"
#include "native_mate/persistent_dictionary.h"
@class AtomNSWindow; @class AtomNSWindow;
@class AtomNSWindowDelegate; @class AtomNSWindowDelegate;
@ -103,7 +101,8 @@ class NativeWindowMac : public NativeWindow,
void SetVibrancy(const std::string& type) override; void SetVibrancy(const std::string& type) override;
void DestroyTouchBar() override; void DestroyTouchBar() override;
void SetTouchBar(mate::Arguments* args) override; void SetTouchBar(
const std::vector<mate::PersistentDictionary>& items) override;
void RefreshTouchBarItem(const std::string& item_id) override; void RefreshTouchBarItem(const std::string& item_id) override;
std::vector<mate::PersistentDictionary> GetTouchBarItems(); std::vector<mate::PersistentDictionary> GetTouchBarItems();

View file

@ -1374,13 +1374,11 @@ void NativeWindowMac::DestroyTouchBar() {
[window_ resetTouchBar]; [window_ resetTouchBar];
} }
void NativeWindowMac::SetTouchBar(mate::Arguments* args) { void NativeWindowMac::SetTouchBar(
std::vector<mate::PersistentDictionary> items; const std::vector<mate::PersistentDictionary>& items) {
if (args->GetNext(&items)) {
touch_bar_items_ = items; touch_bar_items_ = items;
[window_ resetTouchBar]; [window_ resetTouchBar];
} }
}
void NativeWindowMac::RefreshTouchBarItem(const std::string& item_id) { void NativeWindowMac::RefreshTouchBarItem(const std::string& item_id) {
[window_ refreshTouchBarItem:item_id]; [window_ refreshTouchBarItem:item_id];