chore: rename atom -> electron (#21986)

This commit is contained in:
Jeremy Apthorp 2020-02-04 12:19:40 -08:00 committed by GitHub
parent f14fc4b041
commit d9321f4df7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
287 changed files with 1771 additions and 1708 deletions

View file

@ -68,11 +68,11 @@ bool StringToAccelerator(const std::string& shortcut,
}
void GenerateAcceleratorTable(AcceleratorTable* table,
electron::AtomMenuModel* model) {
electron::ElectronMenuModel* model) {
int count = model->GetItemCount();
for (int i = 0; i < count; ++i) {
electron::AtomMenuModel::ItemType type = model->GetTypeAt(i);
if (type == electron::AtomMenuModel::TYPE_SUBMENU) {
electron::ElectronMenuModel::ItemType type = model->GetTypeAt(i);
if (type == electron::ElectronMenuModel::TYPE_SUBMENU) {
auto* submodel = model->GetSubmenuModelAt(i);
GenerateAcceleratorTable(table, submodel);
} else {

View file

@ -8,14 +8,14 @@
#include <map>
#include <string>
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "ui/base/accelerators/accelerator.h"
namespace accelerator_util {
typedef struct {
int position;
electron::AtomMenuModel* model;
electron::ElectronMenuModel* model;
} MenuItem;
typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
@ -25,7 +25,7 @@ bool StringToAccelerator(const std::string& description,
// Generate a table that contains memu model's accelerators and command ids.
void GenerateAcceleratorTable(AcceleratorTable* table,
electron::AtomMenuModel* model);
electron::ElectronMenuModel* model);
// Trigger command from the accelerators table.
bool TriggerAcceleratorTableCommand(AcceleratorTable* table,

View file

@ -1,35 +0,0 @@
// Copyright (c) 2018 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_COCOA_ATOM_NATIVE_WIDGET_MAC_H_
#define SHELL_BROWSER_UI_COCOA_ATOM_NATIVE_WIDGET_MAC_H_
#include "ui/views/widget/native_widget_mac.h"
namespace electron {
class NativeWindowMac;
class AtomNativeWidgetMac : public views::NativeWidgetMac {
public:
AtomNativeWidgetMac(NativeWindowMac* shell,
NSUInteger style_mask,
views::internal::NativeWidgetDelegate* delegate);
~AtomNativeWidgetMac() override;
protected:
// NativeWidgetMac:
NativeWidgetMacNSWindow* CreateNSWindow(
const remote_cocoa::mojom::CreateWindowParams* params) override;
private:
NativeWindowMac* shell_;
NSUInteger style_mask_;
DISALLOW_COPY_AND_ASSIGN(AtomNativeWidgetMac);
};
} // namespace electron
#endif // SHELL_BROWSER_UI_COCOA_ATOM_NATIVE_WIDGET_MAC_H_

View file

@ -2,8 +2,10 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_COCOA_ATOM_BUNDLE_MOVER_H_
#define SHELL_BROWSER_UI_COCOA_ATOM_BUNDLE_MOVER_H_
#ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_BUNDLE_MOVER_H_
#define SHELL_BROWSER_UI_COCOA_ELECTRON_BUNDLE_MOVER_H_
#include <string>
#include "base/mac/foundation_util.h"
#include "shell/common/gin_helper/error_thrower.h"
@ -17,7 +19,7 @@ namespace electron {
// Possible bundle movement conflicts
enum class BundlerMoverConflictType { EXISTS, EXISTS_AND_RUNNING };
class AtomBundleMover {
class ElectronBundleMover {
public:
static bool Move(gin_helper::ErrorThrower thrower, gin::Arguments* args);
static bool IsCurrentAppInApplicationsFolder();
@ -41,4 +43,4 @@ class AtomBundleMover {
} // namespace electron
#endif // SHELL_BROWSER_UI_COCOA_ATOM_BUNDLE_MOVER_H_
#endif // SHELL_BROWSER_UI_COCOA_ELECTRON_BUNDLE_MOVER_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import "shell/browser/ui/cocoa/atom_bundle_mover.h"
#import "shell/browser/ui/cocoa/electron_bundle_mover.h"
#import <AppKit/AppKit.h>
#import <Security/Security.h>
@ -38,9 +38,9 @@ struct Converter<electron::BundlerMoverConflictType> {
namespace electron {
bool AtomBundleMover::ShouldContinueMove(gin_helper::ErrorThrower thrower,
BundlerMoverConflictType type,
gin::Arguments* args) {
bool ElectronBundleMover::ShouldContinueMove(gin_helper::ErrorThrower thrower,
BundlerMoverConflictType type,
gin::Arguments* args) {
gin::Dictionary options(args->isolate());
bool hasOptions = args->GetNext(&options);
base::OnceCallback<v8::Local<v8::Value>(BundlerMoverConflictType)>
@ -61,8 +61,8 @@ bool AtomBundleMover::ShouldContinueMove(gin_helper::ErrorThrower thrower,
return true;
}
bool AtomBundleMover::Move(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
bool ElectronBundleMover::Move(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
// Path of the current bundle
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
@ -178,11 +178,11 @@ bool AtomBundleMover::Move(gin_helper::ErrorThrower thrower,
return true;
}
bool AtomBundleMover::IsCurrentAppInApplicationsFolder() {
bool ElectronBundleMover::IsCurrentAppInApplicationsFolder() {
return IsInApplicationsFolder([[NSBundle mainBundle] bundlePath]);
}
bool AtomBundleMover::IsInApplicationsFolder(NSString* bundlePath) {
bool ElectronBundleMover::IsInApplicationsFolder(NSString* bundlePath) {
// Check all the normal Application directories
NSArray* applicationDirs = NSSearchPathForDirectoriesInDomains(
NSApplicationDirectory, NSAllDomainsMask, true);
@ -199,7 +199,7 @@ bool AtomBundleMover::IsInApplicationsFolder(NSString* bundlePath) {
return false;
}
NSString* AtomBundleMover::ContainingDiskImageDevice(NSString* bundlePath) {
NSString* ElectronBundleMover::ContainingDiskImageDevice(NSString* bundlePath) {
NSString* containingPath = [bundlePath stringByDeletingLastPathComponent];
struct statfs fs;
@ -258,9 +258,9 @@ NSString* AtomBundleMover::ContainingDiskImageDevice(NSString* bundlePath) {
return nil;
}
bool AtomBundleMover::AuthorizedInstall(NSString* srcPath,
NSString* dstPath,
bool* canceled) {
bool ElectronBundleMover::AuthorizedInstall(NSString* srcPath,
NSString* dstPath,
bool* canceled) {
if (canceled)
*canceled = false;
@ -361,21 +361,21 @@ fail:
return false;
}
bool AtomBundleMover::CopyBundle(NSString* srcPath, NSString* dstPath) {
bool ElectronBundleMover::CopyBundle(NSString* srcPath, NSString* dstPath) {
NSFileManager* fileManager = [NSFileManager defaultManager];
NSError* error = nil;
return [fileManager copyItemAtPath:srcPath toPath:dstPath error:&error];
}
NSString* AtomBundleMover::ShellQuotedString(NSString* string) {
NSString* ElectronBundleMover::ShellQuotedString(NSString* string) {
return [NSString
stringWithFormat:@"'%@'",
[string stringByReplacingOccurrencesOfString:@"'"
withString:@"'\\''"]];
}
void AtomBundleMover::Relaunch(NSString* destinationPath) {
void ElectronBundleMover::Relaunch(NSString* destinationPath) {
// The shell script waits until the original app process terminates.
// This is done so that the relaunched app opens as the front-most app.
int pid = [[NSProcessInfo processInfo] processIdentifier];
@ -402,7 +402,7 @@ void AtomBundleMover::Relaunch(NSString* destinationPath) {
arguments:[NSArray arrayWithObjects:@"-c", script, nil]];
}
bool AtomBundleMover::IsApplicationAtPathRunning(NSString* bundlePath) {
bool ElectronBundleMover::IsApplicationAtPathRunning(NSString* bundlePath) {
bundlePath = [bundlePath stringByStandardizingPath];
for (NSRunningApplication* runningApplication in
@ -416,7 +416,7 @@ bool AtomBundleMover::IsApplicationAtPathRunning(NSString* bundlePath) {
return false;
}
bool AtomBundleMover::Trash(NSString* path) {
bool ElectronBundleMover::Trash(NSString* path) {
bool result = false;
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_8) {
@ -456,7 +456,7 @@ end tell
return result;
}
bool AtomBundleMover::DeleteOrTrash(NSString* path) {
bool ElectronBundleMover::DeleteOrTrash(NSString* path) {
NSError* error;
if ([[NSFileManager defaultManager] removeItemAtPath:path error:&error]) {

View file

@ -17,7 +17,7 @@ class InspectableWebContentsViewMac;
using electron::InspectableWebContentsViewMac;
@interface AtomInspectableWebContentsView : BaseView <NSWindowDelegate> {
@interface ElectronInspectableWebContentsView : BaseView <NSWindowDelegate> {
@private
electron::InspectableWebContentsViewMac* inspectableWebContentsView_;

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#include "shell/browser/ui/cocoa/atom_inspectable_web_contents_view.h"
#include "shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h"
#include "content/public/browser/render_widget_host_view.h"
#include "shell/browser/ui/cocoa/event_dispatching_window.h"
@ -11,7 +11,7 @@
#include "shell/browser/ui/inspectable_web_contents_view_mac.h"
#include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h"
@implementation AtomInspectableWebContentsView
@implementation ElectronInspectableWebContentsView
- (instancetype)initWithInspectableWebContentsViewMac:
(InspectableWebContentsViewMac*)view {

View file

@ -3,8 +3,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_COCOA_ATOM_MENU_CONTROLLER_H_
#define SHELL_BROWSER_UI_COCOA_ATOM_MENU_CONTROLLER_H_
#ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_MENU_CONTROLLER_H_
#define SHELL_BROWSER_UI_COCOA_ELECTRON_MENU_CONTROLLER_H_
#import <Cocoa/Cocoa.h>
@ -13,7 +13,7 @@
#include "base/strings/string16.h"
namespace electron {
class AtomMenuModel;
class ElectronMenuModel;
}
// A controller for the cross-platform menu model. The menu that's created
@ -22,26 +22,26 @@ class AtomMenuModel;
// allow for hierarchical menus). The tag is the index into that model for
// that particular item. It is important that the model outlives this object
// as it only maintains weak references.
@interface AtomMenuController : NSObject <NSMenuDelegate> {
@interface ElectronMenuController : NSObject <NSMenuDelegate> {
@protected
electron::AtomMenuModel* model_; // weak
electron::ElectronMenuModel* model_; // weak
base::scoped_nsobject<NSMenu> menu_;
BOOL isMenuOpen_;
BOOL useDefaultAccelerator_;
base::OnceClosure closeCallback;
}
@property(nonatomic, assign) electron::AtomMenuModel* model;
@property(nonatomic, assign) electron::ElectronMenuModel* model;
// Builds a NSMenu from the pre-built model (must not be nil). Changes made
// to the contents of the model after calling this will not be noticed.
- (id)initWithModel:(electron::AtomMenuModel*)model
- (id)initWithModel:(electron::ElectronMenuModel*)model
useDefaultAccelerator:(BOOL)use;
- (void)setCloseCallback:(base::OnceClosure)callback;
// Populate current NSMenu with |model|.
- (void)populateWithModel:(electron::AtomMenuModel*)model;
- (void)populateWithModel:(electron::ElectronMenuModel*)model;
// Programmatically close the constructed menu.
- (void)cancel;
@ -60,4 +60,4 @@ class AtomMenuModel;
@end
#endif // SHELL_BROWSER_UI_COCOA_ATOM_MENU_CONTROLLER_H_
#endif // SHELL_BROWSER_UI_COCOA_ELECTRON_MENU_CONTROLLER_H_

View file

@ -3,7 +3,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import "shell/browser/ui/cocoa/atom_menu_controller.h"
#import "shell/browser/ui/cocoa/electron_menu_controller.h"
#include <utility>
@ -13,8 +13,8 @@
#include "base/task/post_task.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "shell/browser/mac/atom_application.h"
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/mac/electron_application.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/platform_accelerator_cocoa.h"
#include "ui/base/l10n/l10n_util_mac.h"
@ -64,7 +64,7 @@ Role kRolesMap[] = {
// Called when adding a submenu to the menu and checks if the submenu, via its
// |model|, has visible child items.
bool MenuHasVisibleItems(const electron::AtomMenuModel* model) {
bool MenuHasVisibleItems(const electron::ElectronMenuModel* model) {
int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->IsVisibleAt(index))
@ -93,11 +93,11 @@ static base::scoped_nsobject<NSMenuItem> recentDocumentsMenuItem_;
// Submenu retained to be swapped back to |recentDocumentsMenuItem_|
static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
@implementation AtomMenuController
@implementation ElectronMenuController
@synthesize model = model_;
- (id)initWithModel:(electron::AtomMenuModel*)model
- (id)initWithModel:(electron::ElectronMenuModel*)model
useDefaultAccelerator:(BOOL)use {
if ((self = [super init])) {
model_ = model;
@ -124,7 +124,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
closeCallback = std::move(callback);
}
- (void)populateWithModel:(electron::AtomMenuModel*)model {
- (void)populateWithModel:(electron::ElectronMenuModel*)model {
if (!menu_)
return;
@ -142,7 +142,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
const int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->GetTypeAt(index) == electron::AtomMenuModel::TYPE_SEPARATOR)
if (model->GetTypeAt(index) == electron::ElectronMenuModel::TYPE_SEPARATOR)
[self addSeparatorToMenu:menu_ atIndex:index];
else
[self addItemToMenu:menu_ atIndex:index fromModel:model];
@ -162,12 +162,12 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// Creates a NSMenu from the given model. If the model has submenus, this can
// be invoked recursively.
- (NSMenu*)menuFromModel:(electron::AtomMenuModel*)model {
- (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model {
NSMenu* menu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
const int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->GetTypeAt(index) == electron::AtomMenuModel::TYPE_SEPARATOR)
if (model->GetTypeAt(index) == electron::ElectronMenuModel::TYPE_SEPARATOR)
[self addSeparatorToMenu:menu atIndex:index];
else
[self addItemToMenu:menu atIndex:index fromModel:model];
@ -226,7 +226,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// associated with the entry in the model identified by |modelIndex|.
- (void)addItemToMenu:(NSMenu*)menu
atIndex:(NSInteger)index
fromModel:(electron::AtomMenuModel*)model {
fromModel:(electron::ElectronMenuModel*)model {
base::string16 label16 = model->GetLabelAt(index);
NSString* label = l10n_util::FixUpWindowsStyleLabel(label16);
@ -244,7 +244,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
[item setToolTip:base::SysUTF16ToNSString(toolTip)];
base::string16 role = model->GetRoleAt(index);
electron::AtomMenuModel::ItemType type = model->GetTypeAt(index);
electron::ElectronMenuModel::ItemType type = model->GetTypeAt(index);
if (role == base::ASCIIToUTF16("services")) {
base::string16 title = base::ASCIIToUTF16("Services");
@ -255,7 +255,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
NSMenu* submenu = [[NSMenu alloc] initWithTitle:label];
[item setSubmenu:submenu];
[NSApp setServicesMenu:submenu];
} else if (type == electron::AtomMenuModel::TYPE_SUBMENU &&
} else if (type == electron::ElectronMenuModel::TYPE_SUBMENU &&
model->IsVisibleAt(index)) {
// We need to specifically check that the submenu top-level item has been
// enabled as it's not validated by validateUserInterfaceItem
@ -265,8 +265,9 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// Recursively build a submenu from the sub-model at this index.
[item setTarget:nil];
[item setAction:nil];
electron::AtomMenuModel* submenuModel =
static_cast<electron::AtomMenuModel*>(model->GetSubmenuModelAt(index));
electron::ElectronMenuModel* submenuModel =
static_cast<electron::ElectronMenuModel*>(
model->GetSubmenuModelAt(index));
NSMenu* submenu = MenuHasVisibleItems(submenuModel)
? [self menuFromModel:submenuModel]
: MakeEmptySubmenu();
@ -330,8 +331,9 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
return NO;
NSInteger modelIndex = [item tag];
electron::AtomMenuModel* model = static_cast<electron::AtomMenuModel*>(
[[(id)item representedObject] pointerValue]);
electron::ElectronMenuModel* model =
static_cast<electron::ElectronMenuModel*>(
[[(id)item representedObject] pointerValue]);
DCHECK(model);
if (model) {
BOOL checked = model->IsItemCheckedAt(modelIndex);
@ -349,8 +351,9 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// item chosen.
- (void)itemSelected:(id)sender {
NSInteger modelIndex = [sender tag];
electron::AtomMenuModel* model = static_cast<electron::AtomMenuModel*>(
[[sender representedObject] pointerValue]);
electron::ElectronMenuModel* model =
static_cast<electron::ElectronMenuModel*>(
[[sender representedObject] pointerValue]);
DCHECK(model);
if (model) {
NSEvent* event = [NSApp currentEvent];

View file

@ -0,0 +1,35 @@
// Copyright (c) 2018 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_NATIVE_WIDGET_MAC_H_
#define SHELL_BROWSER_UI_COCOA_ELECTRON_NATIVE_WIDGET_MAC_H_
#include "ui/views/widget/native_widget_mac.h"
namespace electron {
class NativeWindowMac;
class ElectronNativeWidgetMac : public views::NativeWidgetMac {
public:
ElectronNativeWidgetMac(NativeWindowMac* shell,
NSUInteger style_mask,
views::internal::NativeWidgetDelegate* delegate);
~ElectronNativeWidgetMac() override;
protected:
// NativeWidgetMac:
NativeWidgetMacNSWindow* CreateNSWindow(
const remote_cocoa::mojom::CreateWindowParams* params) override;
private:
NativeWindowMac* shell_;
NSUInteger style_mask_;
DISALLOW_COPY_AND_ASSIGN(ElectronNativeWidgetMac);
};
} // namespace electron
#endif // SHELL_BROWSER_UI_COCOA_ELECTRON_NATIVE_WIDGET_MAC_H_

View file

@ -2,13 +2,13 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/cocoa/atom_native_widget_mac.h"
#include "shell/browser/ui/cocoa/electron_native_widget_mac.h"
#include "shell/browser/ui/cocoa/atom_ns_window.h"
#include "shell/browser/ui/cocoa/electron_ns_window.h"
namespace electron {
AtomNativeWidgetMac::AtomNativeWidgetMac(
ElectronNativeWidgetMac::ElectronNativeWidgetMac(
NativeWindowMac* shell,
NSUInteger style_mask,
views::internal::NativeWidgetDelegate* delegate)
@ -16,12 +16,12 @@ AtomNativeWidgetMac::AtomNativeWidgetMac(
shell_(shell),
style_mask_(style_mask) {}
AtomNativeWidgetMac::~AtomNativeWidgetMac() {}
ElectronNativeWidgetMac::~ElectronNativeWidgetMac() {}
NativeWidgetMacNSWindow* AtomNativeWidgetMac::CreateNSWindow(
NativeWidgetMacNSWindow* ElectronNativeWidgetMac::CreateNSWindow(
const remote_cocoa::mojom::CreateWindowParams* params) {
return [[[AtomNSWindow alloc] initWithShell:shell_
styleMask:style_mask_] autorelease];
return [[[ElectronNSWindow alloc] initWithShell:shell_
styleMask:style_mask_] autorelease];
}
} // namespace electron

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_
#define SHELL_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_
#ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_H_
#define SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_H_
#include "components/remote_cocoa/app_shim/native_widget_mac_nswindow.h"
#include "shell/browser/ui/cocoa/event_dispatching_window.h"
@ -27,7 +27,7 @@ class ScopedDisableResize {
} // namespace electron
@interface AtomNSWindow : NativeWidgetMacNSWindow {
@interface ElectronNSWindow : NativeWidgetMacNSWindow {
@private
electron::NativeWindowMac* shell_;
}
@ -46,4 +46,4 @@ class ScopedDisableResize {
- (NSImage*)_cornerMask;
@end
#endif // SHELL_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_
#endif // SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_H_

View file

@ -2,12 +2,12 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/cocoa/atom_ns_window.h"
#include "shell/browser/ui/cocoa/electron_ns_window.h"
#include "base/strings/sys_string_conversions.h"
#include "shell/browser/native_window_mac.h"
#include "shell/browser/ui/cocoa/atom_preview_item.h"
#include "shell/browser/ui/cocoa/atom_touch_bar.h"
#include "shell/browser/ui/cocoa/electron_preview_item.h"
#include "shell/browser/ui/cocoa/electron_touch_bar.h"
#include "shell/browser/ui/cocoa/root_view_mac.h"
#include "ui/base/cocoa/window_size_constants.h"
@ -17,7 +17,7 @@ bool ScopedDisableResize::disable_resize_ = false;
} // namespace electron
@implementation AtomNSWindow
@implementation ElectronNSWindow
@synthesize acceptsFirstMouse;
@synthesize enableLargerThanScreen;

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_COCOA_ATOM_NS_WINDOW_DELEGATE_H_
#define SHELL_BROWSER_UI_COCOA_ATOM_NS_WINDOW_DELEGATE_H_
#ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_DELEGATE_H_
#define SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_DELEGATE_H_
#include <Quartz/Quartz.h>
@ -13,7 +13,7 @@ namespace electron {
class NativeWindowMac;
}
@interface AtomNSWindowDelegate
@interface ElectronNSWindowDelegate
: ViewsNSWindowDelegate <NSTouchBarDelegate, QLPreviewPanelDataSource> {
@private
electron::NativeWindowMac* shell_;
@ -24,4 +24,4 @@ class NativeWindowMac;
- (id)initWithShell:(electron::NativeWindowMac*)shell;
@end
#endif // SHELL_BROWSER_UI_COCOA_ATOM_NS_WINDOW_DELEGATE_H_
#endif // SHELL_BROWSER_UI_COCOA_ELECTRON_NS_WINDOW_DELEGATE_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/cocoa/atom_ns_window_delegate.h"
#include "shell/browser/ui/cocoa/electron_ns_window_delegate.h"
#include <algorithm>
@ -10,15 +10,15 @@
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
#include "shell/browser/browser.h"
#include "shell/browser/native_window_mac.h"
#include "shell/browser/ui/cocoa/atom_preview_item.h"
#include "shell/browser/ui/cocoa/atom_touch_bar.h"
#include "shell/browser/ui/cocoa/electron_preview_item.h"
#include "shell/browser/ui/cocoa/electron_touch_bar.h"
#include "ui/gfx/mac/coordinate_conversion.h"
#include "ui/views/cocoa/native_widget_mac_ns_window_host.h"
#include "ui/views/widget/native_widget_mac.h"
using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
@implementation AtomNSWindowDelegate
@implementation ElectronNSWindowDelegate
- (id)initWithShell:(electron::NativeWindowMac*)shell {
// The views library assumes the window delegate must be an instance of

View file

@ -2,16 +2,16 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_COCOA_ATOM_PREVIEW_ITEM_H_
#define SHELL_BROWSER_UI_COCOA_ATOM_PREVIEW_ITEM_H_
#ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_PREVIEW_ITEM_H_
#define SHELL_BROWSER_UI_COCOA_ELECTRON_PREVIEW_ITEM_H_
#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>
@interface AtomPreviewItem : NSObject <QLPreviewItem>
@interface ElectronPreviewItem : NSObject <QLPreviewItem>
@property(nonatomic, retain) NSURL* previewItemURL;
@property(nonatomic, retain) NSString* previewItemTitle;
- (id)initWithURL:(NSURL*)url title:(NSString*)title;
@end
#endif // SHELL_BROWSER_UI_COCOA_ATOM_PREVIEW_ITEM_H_
#endif // SHELL_BROWSER_UI_COCOA_ELECTRON_PREVIEW_ITEM_H_

View file

@ -2,9 +2,9 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/cocoa/atom_preview_item.h"
#include "shell/browser/ui/cocoa/electron_preview_item.h"
@implementation AtomPreviewItem
@implementation ElectronPreviewItem
@synthesize previewItemURL;
@synthesize previewItemTitle;

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_COCOA_ATOM_TOUCH_BAR_H_
#define SHELL_BROWSER_UI_COCOA_ATOM_TOUCH_BAR_H_
#ifndef SHELL_BROWSER_UI_COCOA_ELECTRON_TOUCH_BAR_H_
#define SHELL_BROWSER_UI_COCOA_ELECTRON_TOUCH_BAR_H_
#import <Cocoa/Cocoa.h>
@ -15,9 +15,9 @@
#include "shell/browser/native_window.h"
#include "shell/common/gin_helper/persistent_dictionary.h"
@interface AtomTouchBar : NSObject <NSScrubberDelegate,
NSScrubberDataSource,
NSScrubberFlowLayoutDelegate> {
@interface ElectronTouchBar : NSObject <NSScrubberDelegate,
NSScrubberDataSource,
NSScrubberFlowLayoutDelegate> {
@protected
std::vector<gin_helper::PersistentDictionary> ordered_settings_;
std::map<std::string, gin_helper::PersistentDictionary> settings_;
@ -96,4 +96,4 @@
@end
#endif // SHELL_BROWSER_UI_COCOA_ATOM_TOUCH_BAR_H_
#endif // SHELL_BROWSER_UI_COCOA_ELECTRON_TOUCH_BAR_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import "shell/browser/ui/cocoa/atom_touch_bar.h"
#import "shell/browser/ui/cocoa/electron_touch_bar.h"
#include <string>
#include <utility>
@ -14,7 +14,7 @@
#include "skia/ext/skia_utils_mac.h"
#include "ui/gfx/image/image.h"
@implementation AtomTouchBar
@implementation ElectronTouchBar
static NSTouchBarItemIdentifier ButtonIdentifier =
@"com.electron.touchbar.button.";

View file

@ -27,7 +27,7 @@
#include "net/base/net_errors.h"
#include "net/socket/stream_socket.h"
#include "net/socket/tcp_server_socket.h"
#include "shell/browser/atom_paths.h"
#include "shell/browser/electron_paths.h"
#include "ui/base/resource/resource_bundle.h"
namespace electron {

View file

@ -2,57 +2,57 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "base/stl_util.h"
namespace electron {
bool AtomMenuModel::Delegate::GetAcceleratorForCommandId(
bool ElectronMenuModel::Delegate::GetAcceleratorForCommandId(
int command_id,
ui::Accelerator* accelerator) const {
return GetAcceleratorForCommandIdWithParams(command_id, false, accelerator);
}
AtomMenuModel::AtomMenuModel(Delegate* delegate)
ElectronMenuModel::ElectronMenuModel(Delegate* delegate)
: ui::SimpleMenuModel(delegate), delegate_(delegate) {}
AtomMenuModel::~AtomMenuModel() = default;
ElectronMenuModel::~ElectronMenuModel() = default;
void AtomMenuModel::SetToolTip(int index, const base::string16& toolTip) {
void ElectronMenuModel::SetToolTip(int index, const base::string16& toolTip) {
int command_id = GetCommandIdAt(index);
toolTips_[command_id] = toolTip;
}
base::string16 AtomMenuModel::GetToolTipAt(int index) {
base::string16 ElectronMenuModel::GetToolTipAt(int index) {
const int command_id = GetCommandIdAt(index);
const auto iter = toolTips_.find(command_id);
return iter == std::end(toolTips_) ? base::string16() : iter->second;
}
void AtomMenuModel::SetRole(int index, const base::string16& role) {
void ElectronMenuModel::SetRole(int index, const base::string16& role) {
int command_id = GetCommandIdAt(index);
roles_[command_id] = role;
}
base::string16 AtomMenuModel::GetRoleAt(int index) {
base::string16 ElectronMenuModel::GetRoleAt(int index) {
const int command_id = GetCommandIdAt(index);
const auto iter = roles_.find(command_id);
return iter == std::end(roles_) ? base::string16() : iter->second;
}
void AtomMenuModel::SetSublabel(int index, const base::string16& sublabel) {
void ElectronMenuModel::SetSublabel(int index, const base::string16& sublabel) {
int command_id = GetCommandIdAt(index);
sublabels_[command_id] = sublabel;
}
base::string16 AtomMenuModel::GetSublabelAt(int index) const {
base::string16 ElectronMenuModel::GetSublabelAt(int index) const {
int command_id = GetCommandIdAt(index);
const auto iter = sublabels_.find(command_id);
return iter == std::end(sublabels_) ? base::string16() : iter->second;
}
bool AtomMenuModel::GetAcceleratorAtWithParams(
bool ElectronMenuModel::GetAcceleratorAtWithParams(
int index,
bool use_default_accelerator,
ui::Accelerator* accelerator) const {
@ -63,7 +63,7 @@ bool AtomMenuModel::GetAcceleratorAtWithParams(
return false;
}
bool AtomMenuModel::ShouldRegisterAcceleratorAt(int index) const {
bool ElectronMenuModel::ShouldRegisterAcceleratorAt(int index) const {
if (delegate_) {
return delegate_->ShouldRegisterAcceleratorForCommandId(
GetCommandIdAt(index));
@ -71,29 +71,29 @@ bool AtomMenuModel::ShouldRegisterAcceleratorAt(int index) const {
return true;
}
bool AtomMenuModel::WorksWhenHiddenAt(int index) const {
bool ElectronMenuModel::WorksWhenHiddenAt(int index) const {
if (delegate_) {
return delegate_->ShouldCommandIdWorkWhenHidden(GetCommandIdAt(index));
}
return true;
}
void AtomMenuModel::MenuWillClose() {
void ElectronMenuModel::MenuWillClose() {
ui::SimpleMenuModel::MenuWillClose();
for (Observer& observer : observers_) {
observer.OnMenuWillClose();
}
}
void AtomMenuModel::MenuWillShow() {
void ElectronMenuModel::MenuWillShow() {
ui::SimpleMenuModel::MenuWillShow();
for (Observer& observer : observers_) {
observer.OnMenuWillShow();
}
}
AtomMenuModel* AtomMenuModel::GetSubmenuModelAt(int index) {
return static_cast<AtomMenuModel*>(
ElectronMenuModel* ElectronMenuModel::GetSubmenuModelAt(int index) {
return static_cast<ElectronMenuModel*>(
ui::SimpleMenuModel::GetSubmenuModelAt(index));
}

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_ATOM_MENU_MODEL_H_
#define SHELL_BROWSER_UI_ATOM_MENU_MODEL_H_
#ifndef SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_
#define SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_
#include <map>
@ -13,7 +13,7 @@
namespace electron {
class AtomMenuModel : public ui::SimpleMenuModel {
class ElectronMenuModel : public ui::SimpleMenuModel {
public:
class Delegate : public ui::SimpleMenuModel::Delegate {
public:
@ -47,8 +47,8 @@ class AtomMenuModel : public ui::SimpleMenuModel {
virtual void OnMenuWillClose() {}
};
explicit AtomMenuModel(Delegate* delegate);
~AtomMenuModel() override;
explicit ElectronMenuModel(Delegate* delegate);
~ElectronMenuModel() override;
void AddObserver(Observer* obs) { observers_.AddObserver(obs); }
void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); }
@ -70,7 +70,7 @@ class AtomMenuModel : public ui::SimpleMenuModel {
void MenuWillShow() override;
using SimpleMenuModel::GetSubmenuModelAt;
AtomMenuModel* GetSubmenuModelAt(int index);
ElectronMenuModel* GetSubmenuModelAt(int index);
private:
Delegate* delegate_; // weak ref.
@ -80,9 +80,9 @@ class AtomMenuModel : public ui::SimpleMenuModel {
std::map<int, base::string16> sublabels_; // command id -> sublabel
base::ObserverList<Observer> observers_;
DISALLOW_COPY_AND_ASSIGN(AtomMenuModel);
DISALLOW_COPY_AND_ASSIGN(ElectronMenuModel);
};
} // namespace electron
#endif // SHELL_BROWSER_UI_ATOM_MENU_MODEL_H_
#endif // SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_

View file

@ -62,10 +62,10 @@
@end
// Manages the PopUpButtonHandler.
@interface AtomAccessoryView : NSView
@interface ElectronAccessoryView : NSView
@end
@implementation AtomAccessoryView
@implementation ElectronAccessoryView
- (void)dealloc {
auto* popupButton =
@ -114,8 +114,8 @@ void SetAllowedFileTypes(NSSavePanel* dialog, const Filters& filters) {
return; // don't add file format picker
// Add file format picker.
AtomAccessoryView* accessoryView =
[[AtomAccessoryView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 200, 32.0)];
ElectronAccessoryView* accessoryView = [[ElectronAccessoryView alloc]
initWithFrame:NSMakeRect(0.0, 0.0, 200, 32.0)];
NSTextField* label =
[[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 60, 22)];

View file

@ -56,7 +56,7 @@
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_url_handlers.h"
#include "extensions/common/permissions/permissions_data.h"
#include "shell/browser/atom_browser_context.h"
#include "shell/browser/electron_browser_context.h"
#endif
namespace electron {

View file

@ -10,7 +10,7 @@
#include "base/mac/scoped_nsobject.h"
@class AtomInspectableWebContentsView;
@class ElectronInspectableWebContentsView;
namespace electron {
@ -40,7 +40,7 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView {
// Owns us.
InspectableWebContentsImpl* inspectable_web_contents_;
base::scoped_nsobject<AtomInspectableWebContentsView> view_;
base::scoped_nsobject<ElectronInspectableWebContentsView> view_;
DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewMac);
};

View file

@ -8,7 +8,7 @@
#import <AppKit/AppKit.h>
#include "base/strings/sys_string_conversions.h"
#import "shell/browser/ui/cocoa/atom_inspectable_web_contents_view.h"
#import "shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h"
#include "shell/browser/ui/inspectable_web_contents.h"
#include "shell/browser/ui/inspectable_web_contents_view_delegate.h"
@ -22,7 +22,7 @@ InspectableWebContentsView* CreateInspectableContentsView(
InspectableWebContentsViewMac::InspectableWebContentsViewMac(
InspectableWebContentsImpl* inspectable_web_contents)
: inspectable_web_contents_(inspectable_web_contents),
view_([[AtomInspectableWebContentsView alloc]
view_([[ElectronInspectableWebContentsView alloc]
initWithInspectableWebContentsViewMac:this]) {}
InspectableWebContentsViewMac::~InspectableWebContentsViewMac() {

View file

@ -21,7 +21,7 @@ void TrayIcon::RemoveBalloon() {}
void TrayIcon::Focus() {}
void TrayIcon::PopUpContextMenu(const gfx::Point& pos,
AtomMenuModel* menu_model) {}
ElectronMenuModel* menu_model) {}
void TrayIcon::CloseContextMenu() {}

View file

@ -9,7 +9,7 @@
#include <vector>
#include "base/observer_list.h"
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "shell/browser/ui/tray_icon_observer.h"
#include "shell/common/gin_converters/guid_converter.h"
#include "ui/gfx/geometry/rect.h"
@ -80,12 +80,12 @@ class TrayIcon {
// Popups the menu.
virtual void PopUpContextMenu(const gfx::Point& pos,
AtomMenuModel* menu_model);
ElectronMenuModel* menu_model);
virtual void CloseContextMenu();
// Set the context menu for this icon.
virtual void SetContextMenu(AtomMenuModel* menu_model) = 0;
virtual void SetContextMenu(ElectronMenuModel* menu_model) = 0;
// Returns the bounds of tray icon.
virtual gfx::Rect GetBounds();

View file

@ -12,7 +12,7 @@
#include "base/mac/scoped_nsobject.h"
#include "shell/browser/ui/tray_icon.h"
@class AtomMenuController;
@class ElectronMenuController;
@class StatusItemView;
namespace electron {
@ -29,11 +29,11 @@ class TrayIconCocoa : public TrayIcon {
std::string GetTitle() override;
void SetIgnoreDoubleClickEvents(bool ignore) override;
bool GetIgnoreDoubleClickEvents() override;
void PopUpOnUI(AtomMenuModel* menu_model);
void PopUpOnUI(ElectronMenuModel* menu_model);
void PopUpContextMenu(const gfx::Point& pos,
AtomMenuModel* menu_model) override;
ElectronMenuModel* menu_model) override;
void CloseContextMenu() override;
void SetContextMenu(AtomMenuModel* menu_model) override;
void SetContextMenu(ElectronMenuModel* menu_model) override;
gfx::Rect GetBounds() override;
private:
@ -41,7 +41,7 @@ class TrayIconCocoa : public TrayIcon {
base::scoped_nsobject<StatusItemView> status_item_view_;
// Status menu shown when right-clicking the system icon.
base::scoped_nsobject<AtomMenuController> menu_;
base::scoped_nsobject<ElectronMenuController> menu_;
base::WeakPtrFactory<TrayIconCocoa> weak_factory_;

View file

@ -14,14 +14,14 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "shell/browser/ui/cocoa/NSString+ANSI.h"
#include "shell/browser/ui/cocoa/atom_menu_controller.h"
#include "shell/browser/ui/cocoa/electron_menu_controller.h"
#include "ui/events/cocoa/cocoa_event_utils.h"
#include "ui/gfx/mac/coordinate_conversion.h"
#include "ui/native_theme/native_theme.h"
@interface StatusItemView : NSView {
electron::TrayIconCocoa* trayIcon_; // weak
AtomMenuController* menuController_; // weak
electron::TrayIconCocoa* trayIcon_; // weak
ElectronMenuController* menuController_; // weak
BOOL ignoreDoubleClickEvents_;
base::scoped_nsobject<NSStatusItem> statusItem_;
base::scoped_nsobject<NSTrackingArea> trackingArea_;
@ -125,7 +125,7 @@
return [statusItem_ button].title;
}
- (void)setMenuController:(AtomMenuController*)menu {
- (void)setMenuController:(ElectronMenuController*)menu {
menuController_ = menu;
[statusItem_ setMenu:[menuController_ menu]];
}
@ -170,15 +170,15 @@
ui::EventFlagsFromModifiers([event modifierFlags]));
}
- (void)popUpContextMenu:(electron::AtomMenuModel*)menu_model {
- (void)popUpContextMenu:(electron::ElectronMenuModel*)menu_model {
// Make sure events can be pumped while the menu is up.
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
// Show a custom menu.
if (menu_model) {
base::scoped_nsobject<AtomMenuController> menuController(
[[AtomMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO]);
base::scoped_nsobject<ElectronMenuController> menuController(
[[ElectronMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO]);
// Hacky way to mimic design of ordinary tray menu.
[statusItem_ setMenu:[menuController menu]];
[[statusItem_ button] performClick:self];
@ -309,12 +309,12 @@ bool TrayIconCocoa::GetIgnoreDoubleClickEvents() {
return [status_item_view_ getIgnoreDoubleClickEvents];
}
void TrayIconCocoa::PopUpOnUI(AtomMenuModel* menu_model) {
void TrayIconCocoa::PopUpOnUI(ElectronMenuModel* menu_model) {
[status_item_view_ popUpContextMenu:menu_model];
}
void TrayIconCocoa::PopUpContextMenu(const gfx::Point& pos,
AtomMenuModel* menu_model) {
ElectronMenuModel* menu_model) {
base::PostTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&TrayIconCocoa::PopUpOnUI, weak_factory_.GetWeakPtr(),
@ -325,11 +325,11 @@ void TrayIconCocoa::CloseContextMenu() {
[status_item_view_ closeContextMenu];
}
void TrayIconCocoa::SetContextMenu(AtomMenuModel* menu_model) {
void TrayIconCocoa::SetContextMenu(ElectronMenuModel* menu_model) {
if (menu_model) {
// Create native menu.
menu_.reset([[AtomMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO]);
menu_.reset([[ElectronMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO]);
} else {
menu_.reset();
}

View file

@ -63,7 +63,7 @@ void TrayIconGtk::SetToolTip(const std::string& tool_tip) {
icon_->SetToolTip(tool_tip_);
}
void TrayIconGtk::SetContextMenu(AtomMenuModel* menu_model) {
void TrayIconGtk::SetContextMenu(ElectronMenuModel* menu_model) {
menu_model_ = menu_model;
icon_->UpdatePlatformContextMenu(menu_model_);
}

View file

@ -26,7 +26,7 @@ class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate {
// TrayIcon:
void SetImage(const gfx::Image& image) override;
void SetToolTip(const std::string& tool_tip) override;
void SetContextMenu(AtomMenuModel* menu_model) override;
void SetContextMenu(ElectronMenuModel* menu_model) override;
// views::StatusIconLinux::Delegate
void OnClick() override;

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#include "shell/browser/ui/views/atom_views_delegate.h"
#include "shell/browser/ui/views/electron_views_delegate.h"
#include <memory>

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#ifndef SHELL_BROWSER_UI_VIEWS_ATOM_VIEWS_DELEGATE_H_
#define SHELL_BROWSER_UI_VIEWS_ATOM_VIEWS_DELEGATE_H_
#ifndef SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_
#define SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_
#include <map>
#include <string>
@ -76,4 +76,4 @@ class ViewsDelegate : public views::ViewsDelegate {
} // namespace electron
#endif // SHELL_BROWSER_UI_VIEWS_ATOM_VIEWS_DELEGATE_H_
#endif // SHELL_BROWSER_UI_VIEWS_ELECTRON_VIEWS_DELEGATE_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file.
#include "shell/browser/ui/views/atom_views_delegate.h"
#include "shell/browser/ui/views/electron_views_delegate.h"
#include <dwmapi.h>
#include <shellapi.h>

View file

@ -12,7 +12,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h"
#include "shell/browser/native_window_views.h"
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/accelerators/menu_label_accelerator_util_linux.h"
@ -134,8 +134,8 @@ void EnsureMethodsLoaded() {
dlsym(dbusmenu_lib, "dbusmenu_server_set_root"));
}
AtomMenuModel* ModelForMenuItem(DbusmenuMenuitem* item) {
return reinterpret_cast<AtomMenuModel*>(
ElectronMenuModel* ModelForMenuItem(DbusmenuMenuitem* item) {
return reinterpret_cast<ElectronMenuModel*>(
g_object_get_data(G_OBJECT(item), "model"));
}
@ -156,7 +156,7 @@ void SetMenuItemID(DbusmenuMenuitem* item, int id) {
g_object_set_data(G_OBJECT(item), "menu-id", GINT_TO_POINTER(id + 1));
}
std::string GetMenuModelStatus(AtomMenuModel* model) {
std::string GetMenuModelStatus(ElectronMenuModel* model) {
std::string ret;
for (int i = 0; i < model->GetItemCount(); ++i) {
int status = model->GetTypeAt(i) | (model->IsVisibleAt(i) << 3) |
@ -192,7 +192,7 @@ std::string GlobalMenuBarX11::GetPathForWindow(gfx::AcceleratedWidget xid) {
return base::StringPrintf("/com/canonical/menu/%lX", xid);
}
void GlobalMenuBarX11::SetMenu(AtomMenuModel* menu_model) {
void GlobalMenuBarX11::SetMenu(ElectronMenuModel* menu_model) {
if (!IsServerStarted())
return;
@ -224,14 +224,14 @@ void GlobalMenuBarX11::OnWindowUnmapped() {
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowUnmapped(xid_);
}
void GlobalMenuBarX11::BuildMenuFromModel(AtomMenuModel* model,
void GlobalMenuBarX11::BuildMenuFromModel(ElectronMenuModel* model,
DbusmenuMenuitem* parent) {
for (int i = 0; i < model->GetItemCount(); ++i) {
DbusmenuMenuitem* item = menuitem_new();
menuitem_property_set_bool(item, kPropertyVisible, model->IsVisibleAt(i));
AtomMenuModel::ItemType type = model->GetTypeAt(i);
if (type == AtomMenuModel::TYPE_SEPARATOR) {
ElectronMenuModel::ItemType type = model->GetTypeAt(i);
if (type == ElectronMenuModel::TYPE_SEPARATOR) {
menuitem_property_set(item, kPropertyType, kTypeSeparator);
} else {
std::string label = ui::ConvertAcceleratorsFromWindowsStyle(
@ -242,7 +242,7 @@ void GlobalMenuBarX11::BuildMenuFromModel(AtomMenuModel* model,
g_object_set_data(G_OBJECT(item), "model", model);
SetMenuItemID(item, i);
if (type == AtomMenuModel::TYPE_SUBMENU) {
if (type == ElectronMenuModel::TYPE_SUBMENU) {
menuitem_property_set(item, kPropertyChildrenDisplay, kDisplaySubmenu);
g_signal_connect(item, "about-to-show", G_CALLBACK(OnSubMenuShowThunk),
this);
@ -254,11 +254,12 @@ void GlobalMenuBarX11::BuildMenuFromModel(AtomMenuModel* model,
g_signal_connect(item, "item-activated",
G_CALLBACK(OnItemActivatedThunk), this);
if (type == AtomMenuModel::TYPE_CHECK ||
type == AtomMenuModel::TYPE_RADIO) {
menuitem_property_set(
item, kPropertyToggleType,
type == AtomMenuModel::TYPE_CHECK ? kToggleCheck : kToggleRadio);
if (type == ElectronMenuModel::TYPE_CHECK ||
type == ElectronMenuModel::TYPE_RADIO) {
menuitem_property_set(item, kPropertyToggleType,
type == ElectronMenuModel::TYPE_CHECK
? kToggleCheck
: kToggleRadio);
menuitem_property_set_int(item, kPropertyToggleState,
model->IsItemCheckedAt(i));
}
@ -303,14 +304,14 @@ void GlobalMenuBarX11::RegisterAccelerator(DbusmenuMenuitem* item,
void GlobalMenuBarX11::OnItemActivated(DbusmenuMenuitem* item,
unsigned int timestamp) {
int id;
AtomMenuModel* model = ModelForMenuItem(item);
ElectronMenuModel* model = ModelForMenuItem(item);
if (model && GetMenuItemID(item, &id))
model->ActivatedAt(id, 0);
}
void GlobalMenuBarX11::OnSubMenuShow(DbusmenuMenuitem* item) {
int id;
AtomMenuModel* model = ModelForMenuItem(item);
ElectronMenuModel* model = ModelForMenuItem(item);
if (!model || !GetMenuItemID(item, &id))
return;

View file

@ -9,7 +9,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "ui/base/glib/glib_signal.h"
#include "ui/gfx/native_widget_types.h"
@ -43,7 +43,7 @@ class GlobalMenuBarX11 {
// Creates the object path for DbusmenuServer which is attached to |xid|.
static std::string GetPathForWindow(gfx::AcceleratedWidget xid);
void SetMenu(AtomMenuModel* menu_model);
void SetMenu(ElectronMenuModel* menu_model);
bool IsServerStarted() const;
// Called by NativeWindow when it show/hides.
@ -55,7 +55,7 @@ class GlobalMenuBarX11 {
void InitServer(gfx::AcceleratedWidget xid);
// Create a menu from menu model.
void BuildMenuFromModel(AtomMenuModel* model, DbusmenuMenuitem* parent);
void BuildMenuFromModel(ElectronMenuModel* model, DbusmenuMenuitem* parent);
// Sets the accelerator for |item|.
void RegisterAccelerator(DbusmenuMenuitem* item,

View file

@ -68,7 +68,7 @@ MenuBar::~MenuBar() {
window_->GetFocusManager()->RemoveFocusChangeListener(color_updater_.get());
}
void MenuBar::SetMenu(AtomMenuModel* model) {
void MenuBar::SetMenu(ElectronMenuModel* model) {
menu_model_ = model;
RebuildChildren();
}
@ -101,7 +101,7 @@ int MenuBar::GetItemCount() const {
}
bool MenuBar::GetMenuButtonFromScreenPoint(const gfx::Point& screenPoint,
AtomMenuModel** menu_model,
ElectronMenuModel** menu_model,
views::MenuButton** button) {
if (!GetBoundsInScreen().Contains(screenPoint))
return false;
@ -109,7 +109,7 @@ bool MenuBar::GetMenuButtonFromScreenPoint(const gfx::Point& screenPoint,
auto children = GetChildrenInZOrder();
for (int i = 0, n = children.size(); i < n; ++i) {
if (children[i]->GetBoundsInScreen().Contains(screenPoint) &&
(menu_model_->GetTypeAt(i) == AtomMenuModel::TYPE_SUBMENU)) {
(menu_model_->GetTypeAt(i) == ElectronMenuModel::TYPE_SUBMENU)) {
*menu_model = menu_model_->GetSubmenuModelAt(i);
*button = static_cast<views::MenuButton*>(children[i]);
return true;
@ -265,8 +265,8 @@ void MenuBar::ButtonPressed(views::Button* source, const ui::Event& event) {
window_->RequestFocus();
int id = source->tag();
AtomMenuModel::ItemType type = menu_model_->GetTypeAt(id);
if (type != AtomMenuModel::TYPE_SUBMENU) {
ElectronMenuModel::ItemType type = menu_model_->GetTypeAt(id);
if (type != ElectronMenuModel::TYPE_SUBMENU) {
menu_model_->ActivatedAt(id, 0);
return;
}

View file

@ -7,7 +7,7 @@
#include <memory>
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "shell/browser/ui/views/menu_delegate.h"
#include "shell/browser/ui/views/root_view.h"
#include "ui/views/accessible_pane_view.h"
@ -46,7 +46,7 @@ class MenuBar : public views::AccessiblePaneView,
~MenuBar() override;
// Replaces current menu with a new one.
void SetMenu(AtomMenuModel* menu_model);
void SetMenu(ElectronMenuModel* menu_model);
// Shows underline under accelerators.
void SetAcceleratorVisibility(bool visible);
@ -62,7 +62,7 @@ class MenuBar : public views::AccessiblePaneView,
// Get the menu under specified screen point.
bool GetMenuButtonFromScreenPoint(const gfx::Point& point,
AtomMenuModel** menu_model,
ElectronMenuModel** menu_model,
views::MenuButton** button);
// electron::MenuDelegate::Observer:
@ -96,7 +96,7 @@ class MenuBar : public views::AccessiblePaneView,
#endif
RootView* window_ = nullptr;
AtomMenuModel* menu_model_ = nullptr;
ElectronMenuModel* menu_model_ = nullptr;
View* FindAccelChild(base::char16 key);

View file

@ -23,7 +23,7 @@ MenuDelegate::MenuDelegate(MenuBar* menu_bar)
MenuDelegate::~MenuDelegate() = default;
void MenuDelegate::RunMenu(AtomMenuModel* model,
void MenuDelegate::RunMenu(ElectronMenuModel* model,
views::Button* button,
ui::MenuSourceType source_type) {
gfx::Point screen_loc;
@ -123,7 +123,7 @@ views::MenuItemView* MenuDelegate::GetSiblingMenu(
// TODO(zcbenz): We should follow Chromium's logics on implementing the
// sibling menu switches, this code is almost a hack.
views::MenuButton* button;
AtomMenuModel* model;
ElectronMenuModel* model;
if (menu_bar_->GetMenuButtonFromScreenPoint(screen_point, &model, &button) &&
button->tag() != id_) {
bool switch_in_progress = !!button_to_open_;

View file

@ -8,7 +8,7 @@
#include <memory>
#include "base/observer_list.h"
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "ui/views/controls/menu/menu_delegate.h"
namespace views {
@ -25,7 +25,7 @@ class MenuDelegate : public views::MenuDelegate {
explicit MenuDelegate(MenuBar* menu_bar);
~MenuDelegate() override;
void RunMenu(AtomMenuModel* model,
void RunMenu(ElectronMenuModel* model,
views::Button* button,
ui::MenuSourceType source_type);

View file

@ -6,7 +6,7 @@
namespace electron {
MenuModelAdapter::MenuModelAdapter(AtomMenuModel* menu_model)
MenuModelAdapter::MenuModelAdapter(ElectronMenuModel* menu_model)
: views::MenuModelAdapter(menu_model), menu_model_(menu_model) {}
MenuModelAdapter::~MenuModelAdapter() = default;
@ -16,7 +16,7 @@ bool MenuModelAdapter::GetAccelerator(int id,
ui::MenuModel* model = menu_model_;
int index = 0;
if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) {
return static_cast<AtomMenuModel*>(model)->GetAcceleratorAtWithParams(
return static_cast<ElectronMenuModel*>(model)->GetAcceleratorAtWithParams(
index, true, accelerator);
}
return false;

View file

@ -5,21 +5,21 @@
#ifndef SHELL_BROWSER_UI_VIEWS_MENU_MODEL_ADAPTER_H_
#define SHELL_BROWSER_UI_VIEWS_MENU_MODEL_ADAPTER_H_
#include "shell/browser/ui/atom_menu_model.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "ui/views/controls/menu/menu_model_adapter.h"
namespace electron {
class MenuModelAdapter : public views::MenuModelAdapter {
public:
explicit MenuModelAdapter(AtomMenuModel* menu_model);
explicit MenuModelAdapter(ElectronMenuModel* menu_model);
~MenuModelAdapter() override;
protected:
bool GetAccelerator(int id, ui::Accelerator* accelerator) const override;
private:
AtomMenuModel* menu_model_;
ElectronMenuModel* menu_model_;
DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter);
};

View file

@ -8,7 +8,7 @@
namespace electron {
const char NativeFrameView::kViewClassName[] = "AtomNativeFrameView";
const char NativeFrameView::kViewClassName[] = "ElectronNativeFrameView";
NativeFrameView::NativeFrameView(NativeWindow* window, views::Widget* widget)
: views::NativeFrameView(widget), window_(window) {}

View file

@ -45,7 +45,7 @@ RootView::RootView(NativeWindow* window)
RootView::~RootView() = default;
void RootView::SetMenu(AtomMenuModel* menu_model) {
void RootView::SetMenu(ElectronMenuModel* menu_model) {
if (menu_model == nullptr) {
// Remove accelerators
UnregisterAcceleratorsWithFocusManager();
@ -201,7 +201,8 @@ bool RootView::AcceleratorPressed(const ui::Accelerator& accelerator) {
accelerator);
}
void RootView::RegisterAcceleratorsWithFocusManager(AtomMenuModel* menu_model) {
void RootView::RegisterAcceleratorsWithFocusManager(
ElectronMenuModel* menu_model) {
if (!menu_model)
return;
// Clear previous accelerators.

View file

@ -18,7 +18,7 @@ struct NativeWebKeyboardEvent;
namespace electron {
class AtomMenuModel;
class ElectronMenuModel;
class MenuBar;
class NativeWindow;
@ -27,7 +27,7 @@ class RootView : public views::View {
explicit RootView(NativeWindow* window);
~RootView() override;
void SetMenu(AtomMenuModel* menu_model);
void SetMenu(ElectronMenuModel* menu_model);
bool HasMenu() const;
int GetMenuBarHeight() const;
void SetAutoHideMenuBar(bool auto_hide);
@ -38,7 +38,7 @@ class RootView : public views::View {
void ResetAltState();
void RestoreFocus();
// Register/Unregister accelerators supported by the menu model.
void RegisterAcceleratorsWithFocusManager(AtomMenuModel* menu_model);
void RegisterAcceleratorsWithFocusManager(ElectronMenuModel* menu_model);
void UnregisterAcceleratorsWithFocusManager();
// views::View:

View file

@ -2,35 +2,35 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/win/atom_desktop_native_widget_aura.h"
#include "shell/browser/ui/win/electron_desktop_native_widget_aura.h"
#include <utility>
#include "shell/browser/ui/win/atom_desktop_window_tree_host_win.h"
#include "shell/browser/ui/win/electron_desktop_window_tree_host_win.h"
#include "ui/views/corewm/tooltip_controller.h"
#include "ui/wm/public/tooltip_client.h"
namespace electron {
AtomDesktopNativeWidgetAura::AtomDesktopNativeWidgetAura(
ElectronDesktopNativeWidgetAura::ElectronDesktopNativeWidgetAura(
NativeWindowViews* native_window_view)
: views::DesktopNativeWidgetAura(native_window_view->widget()),
native_window_view_(native_window_view) {
GetNativeWindow()->SetName("AtomDesktopNativeWidgetAura");
GetNativeWindow()->SetName("ElectronDesktopNativeWidgetAura");
// This is to enable the override of OnWindowActivated
wm::SetActivationChangeObserver(GetNativeWindow(), this);
}
void AtomDesktopNativeWidgetAura::InitNativeWidget(
void ElectronDesktopNativeWidgetAura::InitNativeWidget(
views::Widget::InitParams params) {
desktop_window_tree_host_ = new AtomDesktopWindowTreeHostWin(
desktop_window_tree_host_ = new ElectronDesktopWindowTreeHostWin(
native_window_view_,
static_cast<views::DesktopNativeWidgetAura*>(params.native_widget));
params.desktop_window_tree_host = desktop_window_tree_host_;
views::DesktopNativeWidgetAura::InitNativeWidget(std::move(params));
}
void AtomDesktopNativeWidgetAura::Activate() {
void ElectronDesktopNativeWidgetAura::Activate() {
// Activate can cause the focused window to be blurred so only
// call when the window being activated is visible. This prevents
// hidden windows from blurring the focused window when created.
@ -38,7 +38,7 @@ void AtomDesktopNativeWidgetAura::Activate() {
views::DesktopNativeWidgetAura::Activate();
}
void AtomDesktopNativeWidgetAura::OnWindowActivated(
void ElectronDesktopNativeWidgetAura::OnWindowActivated(
wm::ActivationChangeObserver::ActivationReason reason,
aura::Window* gained_active,
aura::Window* lost_active) {

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_WIN_ATOM_DESKTOP_NATIVE_WIDGET_AURA_H_
#define SHELL_BROWSER_UI_WIN_ATOM_DESKTOP_NATIVE_WIDGET_AURA_H_
#ifndef SHELL_BROWSER_UI_WIN_ELECTRON_DESKTOP_NATIVE_WIDGET_AURA_H_
#define SHELL_BROWSER_UI_WIN_ELECTRON_DESKTOP_NATIVE_WIDGET_AURA_H_
#include "shell/browser/native_window_views.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@ -14,9 +14,10 @@ class DesktopWindowTreeHost;
namespace electron {
class AtomDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
class ElectronDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
public:
explicit AtomDesktopNativeWidgetAura(NativeWindowViews* native_window_view);
explicit ElectronDesktopNativeWidgetAura(
NativeWindowViews* native_window_view);
// views::DesktopNativeWidgetAura:
void InitNativeWidget(views::Widget::InitParams params) override;
@ -34,9 +35,9 @@ class AtomDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
// Owned by DesktopNativeWidgetAura.
views::DesktopWindowTreeHost* desktop_window_tree_host_;
DISALLOW_COPY_AND_ASSIGN(AtomDesktopNativeWidgetAura);
DISALLOW_COPY_AND_ASSIGN(ElectronDesktopNativeWidgetAura);
};
} // namespace electron
#endif // SHELL_BROWSER_UI_WIN_ATOM_DESKTOP_NATIVE_WIDGET_AURA_H_
#endif // SHELL_BROWSER_UI_WIN_ELECTRON_DESKTOP_NATIVE_WIDGET_AURA_H_

View file

@ -2,37 +2,38 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/win/atom_desktop_window_tree_host_win.h"
#include "shell/browser/ui/win/electron_desktop_window_tree_host_win.h"
#include "ui/base/win/hwnd_metrics.h"
namespace electron {
AtomDesktopWindowTreeHostWin::AtomDesktopWindowTreeHostWin(
ElectronDesktopWindowTreeHostWin::ElectronDesktopWindowTreeHostWin(
NativeWindowViews* native_window_view,
views::DesktopNativeWidgetAura* desktop_native_widget_aura)
: views::DesktopWindowTreeHostWin(native_window_view->widget(),
desktop_native_widget_aura),
native_window_view_(native_window_view) {}
AtomDesktopWindowTreeHostWin::~AtomDesktopWindowTreeHostWin() {}
ElectronDesktopWindowTreeHostWin::~ElectronDesktopWindowTreeHostWin() {}
bool AtomDesktopWindowTreeHostWin::PreHandleMSG(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result) {
bool ElectronDesktopWindowTreeHostWin::PreHandleMSG(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result) {
return native_window_view_->PreHandleMSG(message, w_param, l_param, result);
}
bool AtomDesktopWindowTreeHostWin::HasNativeFrame() const {
bool ElectronDesktopWindowTreeHostWin::HasNativeFrame() const {
// Since we never use chromium's titlebar implementation, we can just say
// that we use a native titlebar. This will disable the repaint locking when
// DWM composition is disabled.
return true;
}
bool AtomDesktopWindowTreeHostWin::GetClientAreaInsets(gfx::Insets* insets,
HMONITOR monitor) const {
bool ElectronDesktopWindowTreeHostWin::GetClientAreaInsets(
gfx::Insets* insets,
HMONITOR monitor) const {
if (IsMaximized() && !native_window_view_->has_frame()) {
// Windows automatically adds a standard width border to all sides when a
// window is maximized.

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_WIN_ATOM_DESKTOP_WINDOW_TREE_HOST_WIN_H_
#define SHELL_BROWSER_UI_WIN_ATOM_DESKTOP_WINDOW_TREE_HOST_WIN_H_
#ifndef SHELL_BROWSER_UI_WIN_ELECTRON_DESKTOP_WINDOW_TREE_HOST_WIN_H_
#define SHELL_BROWSER_UI_WIN_ELECTRON_DESKTOP_WINDOW_TREE_HOST_WIN_H_
#include <windows.h>
@ -12,12 +12,13 @@
namespace electron {
class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
class ElectronDesktopWindowTreeHostWin
: public views::DesktopWindowTreeHostWin {
public:
AtomDesktopWindowTreeHostWin(
ElectronDesktopWindowTreeHostWin(
NativeWindowViews* native_window_view,
views::DesktopNativeWidgetAura* desktop_native_widget_aura);
~AtomDesktopWindowTreeHostWin() override;
~ElectronDesktopWindowTreeHostWin() override;
protected:
bool PreHandleMSG(UINT message,
@ -31,9 +32,9 @@ class AtomDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin {
private:
NativeWindowViews* native_window_view_; // weak ref
DISALLOW_COPY_AND_ASSIGN(AtomDesktopWindowTreeHostWin);
DISALLOW_COPY_AND_ASSIGN(ElectronDesktopWindowTreeHostWin);
};
} // namespace electron
#endif // SHELL_BROWSER_UI_WIN_ATOM_DESKTOP_WINDOW_TREE_HOST_WIN_H_
#endif // SHELL_BROWSER_UI_WIN_ELECTRON_DESKTOP_WINDOW_TREE_HOST_WIN_H_

View file

@ -195,7 +195,7 @@ void NotifyIcon::Focus() {
}
void NotifyIcon::PopUpContextMenu(const gfx::Point& pos,
AtomMenuModel* menu_model) {
ElectronMenuModel* menu_model) {
// Returns if context menu isn't set.
if (menu_model == nullptr && menu_model_ == nullptr)
return;
@ -243,7 +243,7 @@ void NotifyIcon::CloseContextMenu() {
}
}
void NotifyIcon::SetContextMenu(AtomMenuModel* menu_model) {
void NotifyIcon::SetContextMenu(ElectronMenuModel* menu_model) {
menu_model_ = menu_model;
}

View file

@ -68,9 +68,9 @@ class NotifyIcon : public TrayIcon {
void RemoveBalloon() override;
void Focus() override;
void PopUpContextMenu(const gfx::Point& pos,
AtomMenuModel* menu_model) override;
ElectronMenuModel* menu_model) override;
void CloseContextMenu() override;
void SetContextMenu(AtomMenuModel* menu_model) override;
void SetContextMenu(ElectronMenuModel* menu_model) override;
gfx::Rect GetBounds() override;
private:
@ -93,7 +93,7 @@ class NotifyIcon : public TrayIcon {
base::win::ScopedHICON icon_;
// The context menu.
AtomMenuModel* menu_model_ = nullptr;
ElectronMenuModel* menu_model_ = nullptr;
// An optional GUID used for identifying tray entries on Windows
GUID guid_ = GUID_DEFAULT;