refactor: rename the atom namespace to electron

This commit is contained in:
Samuel Attard 2019-06-19 14:23:04 -07:00 committed by Samuel Attard
parent 8c4496a9c9
commit 34c4c8d508
531 changed files with 1456 additions and 1428 deletions

View file

@ -9,7 +9,7 @@
#include "native_mate/persistent_dictionary.h"
namespace atom {
namespace electron {
namespace ui {
@ -38,6 +38,6 @@ class AtomBundleMover {
} // namespace ui
} // namespace atom
} // namespace electron
#endif // SHELL_BROWSER_UI_COCOA_ATOM_BUNDLE_MOVER_H_

View file

@ -15,7 +15,7 @@
#import "shell/browser/browser.h"
namespace atom {
namespace electron {
namespace ui {
@ -80,7 +80,7 @@ bool AtomBundleMover::Move(mate::Arguments* args) {
arguments:[NSArray
arrayWithObject:destinationPath]]
waitUntilExit];
atom::Browser::Get()->Quit();
electron::Browser::Get()->Quit();
return true;
} else {
if (!Trash([applicationsDirectory
@ -121,7 +121,7 @@ bool AtomBundleMover::Move(mate::Arguments* args) {
nil]];
}
atom::Browser::Get()->Quit();
electron::Browser::Get()->Quit();
return true;
}
@ -422,4 +422,4 @@ bool AtomBundleMover::DeleteOrTrash(NSString* path) {
} // namespace ui
} // namespace atom
} // namespace electron

View file

@ -11,15 +11,15 @@
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
#include "ui/base/cocoa/base_view.h"
namespace atom {
namespace electron {
class InspectableWebContentsViewMac;
}
using atom::InspectableWebContentsViewMac;
using electron::InspectableWebContentsViewMac;
@interface AtomInspectableWebContentsView : BaseView <NSWindowDelegate> {
@private
atom::InspectableWebContentsViewMac* inspectableWebContentsView_;
electron::InspectableWebContentsViewMac* inspectableWebContentsView_;
base::scoped_nsobject<NSView> fake_view_;
base::scoped_nsobject<NSWindow> devtools_window_;

View file

@ -12,7 +12,7 @@
#include "base/mac/scoped_nsobject.h"
#include "base/strings/string16.h"
namespace atom {
namespace electron {
class AtomMenuModel;
}
@ -24,23 +24,24 @@ class AtomMenuModel;
// as it only maintains weak references.
@interface AtomMenuController : NSObject <NSMenuDelegate> {
@protected
atom::AtomMenuModel* model_; // weak
electron::AtomMenuModel* model_; // weak
base::scoped_nsobject<NSMenu> menu_;
BOOL isMenuOpen_;
BOOL useDefaultAccelerator_;
base::Callback<void()> closeCallback;
}
@property(nonatomic, assign) atom::AtomMenuModel* model;
@property(nonatomic, assign) electron::AtomMenuModel* 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:(atom::AtomMenuModel*)model useDefaultAccelerator:(BOOL)use;
- (id)initWithModel:(electron::AtomMenuModel*)model
useDefaultAccelerator:(BOOL)use;
- (void)setCloseCallback:(const base::Callback<void()>&)callback;
// Populate current NSMenu with |model|.
- (void)populateWithModel:(atom::AtomMenuModel*)model;
- (void)populateWithModel:(electron::AtomMenuModel*)model;
// Programmatically close the constructed menu.
- (void)cancel;

View file

@ -62,7 +62,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 atom::AtomMenuModel* model) {
bool MenuHasVisibleItems(const electron::AtomMenuModel* model) {
int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->IsVisibleAt(index))
@ -95,7 +95,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
@synthesize model = model_;
- (id)initWithModel:(atom::AtomMenuModel*)model
- (id)initWithModel:(electron::AtomMenuModel*)model
useDefaultAccelerator:(BOOL)use {
if ((self = [super init])) {
model_ = model;
@ -122,7 +122,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
closeCallback = callback;
}
- (void)populateWithModel:(atom::AtomMenuModel*)model {
- (void)populateWithModel:(electron::AtomMenuModel*)model {
if (!menu_)
return;
@ -138,7 +138,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
const int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->GetTypeAt(index) == atom::AtomMenuModel::TYPE_SEPARATOR)
if (model->GetTypeAt(index) == electron::AtomMenuModel::TYPE_SEPARATOR)
[self addSeparatorToMenu:menu_ atIndex:index];
else
[self addItemToMenu:menu_ atIndex:index fromModel:model];
@ -158,12 +158,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:(atom::AtomMenuModel*)model {
- (NSMenu*)menuFromModel:(electron::AtomMenuModel*)model {
NSMenu* menu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
const int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->GetTypeAt(index) == atom::AtomMenuModel::TYPE_SEPARATOR)
if (model->GetTypeAt(index) == electron::AtomMenuModel::TYPE_SEPARATOR)
[self addSeparatorToMenu:menu atIndex:index];
else
[self addItemToMenu:menu atIndex:index fromModel:model];
@ -219,7 +219,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:(atom::AtomMenuModel*)model {
fromModel:(electron::AtomMenuModel*)model {
base::string16 label16 = model->GetLabelAt(index);
NSString* label = l10n_util::FixUpWindowsStyleLabel(label16);
@ -234,7 +234,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
[item setImage:icon.ToNSImage()];
base::string16 role = model->GetRoleAt(index);
atom::AtomMenuModel::ItemType type = model->GetTypeAt(index);
electron::AtomMenuModel::ItemType type = model->GetTypeAt(index);
if (role == base::ASCIIToUTF16("services")) {
base::string16 title = base::ASCIIToUTF16("Services");
@ -245,7 +245,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
NSMenu* submenu = [[NSMenu alloc] initWithTitle:label];
[item setSubmenu:submenu];
[NSApp setServicesMenu:submenu];
} else if (type == atom::AtomMenuModel::TYPE_SUBMENU &&
} else if (type == electron::AtomMenuModel::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
@ -255,8 +255,8 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// Recursively build a submenu from the sub-model at this index.
[item setTarget:nil];
[item setAction:nil];
atom::AtomMenuModel* submenuModel =
static_cast<atom::AtomMenuModel*>(model->GetSubmenuModelAt(index));
electron::AtomMenuModel* submenuModel =
static_cast<electron::AtomMenuModel*>(model->GetSubmenuModelAt(index));
NSMenu* submenu = MenuHasVisibleItems(submenuModel)
? [self menuFromModel:submenuModel]
: MakeEmptySubmenu();
@ -320,7 +320,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
return NO;
NSInteger modelIndex = [item tag];
atom::AtomMenuModel* model = static_cast<atom::AtomMenuModel*>(
electron::AtomMenuModel* model = static_cast<electron::AtomMenuModel*>(
[[(id)item representedObject] pointerValue]);
DCHECK(model);
if (model) {
@ -339,7 +339,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// item chosen.
- (void)itemSelected:(id)sender {
NSInteger modelIndex = [sender tag];
atom::AtomMenuModel* model = static_cast<atom::AtomMenuModel*>(
electron::AtomMenuModel* model = static_cast<electron::AtomMenuModel*>(
[[sender representedObject] pointerValue]);
DCHECK(model);
if (model) {

View file

@ -7,7 +7,7 @@
#include "ui/views/widget/native_widget_mac.h"
namespace atom {
namespace electron {
class NativeWindowMac;
@ -30,6 +30,6 @@ class AtomNativeWidgetMac : public views::NativeWidgetMac {
DISALLOW_COPY_AND_ASSIGN(AtomNativeWidgetMac);
};
} // namespace atom
} // namespace electron
#endif // SHELL_BROWSER_UI_COCOA_ATOM_NATIVE_WIDGET_MAC_H_

View file

@ -6,7 +6,7 @@
#include "shell/browser/ui/cocoa/atom_ns_window.h"
namespace atom {
namespace electron {
AtomNativeWidgetMac::AtomNativeWidgetMac(
NativeWindowMac* shell,
@ -24,4 +24,4 @@ NativeWidgetMacNSWindow* AtomNativeWidgetMac::CreateNSWindow(
styleMask:style_mask_] autorelease];
}
} // namespace atom
} // namespace electron

View file

@ -9,7 +9,7 @@
#include "shell/browser/ui/cocoa/event_dispatching_window.h"
#include "ui/views/widget/native_widget_mac.h"
namespace atom {
namespace electron {
class NativeWindowMac;
@ -25,20 +25,20 @@ class ScopedDisableResize {
static bool disable_resize_;
};
} // namespace atom
} // namespace electron
@interface AtomNSWindow : NativeWidgetMacNSWindow {
@private
atom::NativeWindowMac* shell_;
electron::NativeWindowMac* shell_;
}
@property BOOL acceptsFirstMouse;
@property BOOL enableLargerThanScreen;
@property BOOL disableAutoHideCursor;
@property BOOL disableKeyOrMainWindow;
@property(nonatomic, retain) NSView* vibrantView;
- (id)initWithShell:(atom::NativeWindowMac*)shell
- (id)initWithShell:(electron::NativeWindowMac*)shell
styleMask:(NSUInteger)styleMask;
- (atom::NativeWindowMac*)shell;
- (electron::NativeWindowMac*)shell;
- (id)accessibilityFocusedUIElement;
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
- (void)toggleFullScreenMode:(id)sender;

View file

@ -11,11 +11,11 @@
#include "shell/browser/ui/cocoa/root_view_mac.h"
#include "ui/base/cocoa/window_size_constants.h"
namespace atom {
namespace electron {
bool ScopedDisableResize::disable_resize_ = false;
} // namespace atom
} // namespace electron
@implementation AtomNSWindow
@ -25,7 +25,7 @@ bool ScopedDisableResize::disable_resize_ = false;
@synthesize disableKeyOrMainWindow;
@synthesize vibrantView;
- (id)initWithShell:(atom::NativeWindowMac*)shell
- (id)initWithShell:(electron::NativeWindowMac*)shell
styleMask:(NSUInteger)styleMask {
if ((self = [super initWithContentRect:ui::kWindowSizeDeterminedLater
styleMask:styleMask
@ -36,7 +36,7 @@ bool ScopedDisableResize::disable_resize_ = false;
return self;
}
- (atom::NativeWindowMac*)shell {
- (electron::NativeWindowMac*)shell {
return shell_;
}
@ -81,7 +81,7 @@ bool ScopedDisableResize::disable_resize_ = false;
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen*)screen {
// Resizing is disabled.
if (atom::ScopedDisableResize::IsResizeDisabled())
if (electron::ScopedDisableResize::IsResizeDisabled())
return [self frame];
// Enable the window to be larger than screen.
@ -94,7 +94,7 @@ bool ScopedDisableResize::disable_resize_ = false;
- (void)setFrame:(NSRect)windowFrame display:(BOOL)displayViews {
// constrainFrameRect is not called on hidden windows so disable adjusting
// the frame directly when resize is disabled
if (!atom::ScopedDisableResize::IsResizeDisabled())
if (!electron::ScopedDisableResize::IsResizeDisabled())
[super setFrame:windowFrame display:displayViews];
}
@ -157,7 +157,7 @@ bool ScopedDisableResize::disable_resize_ = false;
- (void)performClose:(id)sender {
if (shell_->title_bar_style() ==
atom::NativeWindowMac::TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER) {
electron::NativeWindowMac::TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER) {
[[self delegate] windowShouldClose:self];
} else if (shell_->IsSimpleFullScreen()) {
if ([[self delegate] respondsToSelector:@selector(windowShouldClose:)]) {
@ -182,7 +182,7 @@ bool ScopedDisableResize::disable_resize_ = false;
- (void)performMiniaturize:(id)sender {
if (shell_->title_bar_style() ==
atom::NativeWindowMac::TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER)
electron::NativeWindowMac::TitleBarStyle::CUSTOM_BUTTONS_ON_HOVER)
[self miniaturize:self];
else
[super performMiniaturize:sender];

View file

@ -9,19 +9,19 @@
#include "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
namespace atom {
namespace electron {
class NativeWindowMac;
}
@interface AtomNSWindowDelegate
: ViewsNSWindowDelegate <NSTouchBarDelegate, QLPreviewPanelDataSource> {
@private
atom::NativeWindowMac* shell_;
electron::NativeWindowMac* shell_;
bool is_zooming_;
int level_;
bool is_resizable_;
}
- (id)initWithShell:(atom::NativeWindowMac*)shell;
- (id)initWithShell:(electron::NativeWindowMac*)shell;
@end
#endif // SHELL_BROWSER_UI_COCOA_ATOM_NS_WINDOW_DELEGATE_H_

View file

@ -15,11 +15,11 @@
#include "ui/views/cocoa/native_widget_mac_ns_window_host.h"
#include "ui/views/widget/native_widget_mac.h"
using TitleBarStyle = atom::NativeWindowMac::TitleBarStyle;
using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
@implementation AtomNSWindowDelegate
- (id)initWithShell:(atom::NativeWindowMac*)shell {
- (id)initWithShell:(electron::NativeWindowMac*)shell {
// The views library assumes the window delegate must be an instance of
// ViewsNSWindowDelegate, since we don't have a way to override the creation
// of NSWindowDelegate, we have to dynamically replace the window delegate
@ -278,7 +278,7 @@ using TitleBarStyle = atom::NativeWindowMac::TitleBarStyle;
- (IBAction)newWindowForTab:(id)sender {
shell_->NotifyNewWindowForTab();
atom::Browser::Get()->NewWindowForTab();
electron::Browser::Get()->NewWindowForTab();
}
#pragma mark - NSTouchBarDelegate

View file

@ -24,11 +24,11 @@
std::vector<mate::PersistentDictionary> ordered_settings_;
std::map<std::string, mate::PersistentDictionary> settings_;
id<NSTouchBarDelegate> delegate_;
atom::NativeWindow* window_;
electron::NativeWindow* window_;
}
- (id)initWithDelegate:(id<NSTouchBarDelegate>)delegate
window:(atom::NativeWindow*)window
window:(electron::NativeWindow*)window
settings:(const std::vector<mate::PersistentDictionary>&)settings;
- (NSTouchBar*)makeTouchBar API_AVAILABLE(macosx(10.12.2));

View file

@ -36,7 +36,7 @@ static NSString* const TextScrubberItemIdentifier = @"scrubber.text.item";
static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
- (id)initWithDelegate:(id<NSTouchBarDelegate>)delegate
window:(atom::NativeWindow*)window
window:(electron::NativeWindow*)window
settings:
(const std::vector<mate::PersistentDictionary>&)settings {
if ((self = [super init])) {
@ -244,7 +244,8 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
NSString* item_id = [self idFromIdentifier:identifier
withPrefix:ColorPickerIdentifier];
NSColor* color = ((NSColorPickerTouchBarItem*)sender).color;
std::string hex_color = atom::ToRGBHex(skia::NSDeviceColorToSkColor(color));
std::string hex_color =
electron::ToRGBHex(skia::NSDeviceColorToSkColor(color));
base::DictionaryValue details;
details.SetString("color", hex_color);
window_->NotifyTouchBarItemInteraction([item_id UTF8String], details);
@ -329,7 +330,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
}
- (NSColor*)colorFromHexColorString:(const std::string&)colorString {
SkColor color = atom::ParseHexColor(colorString);
SkColor color = electron::ParseHexColor(colorString);
return skia::SkColorToDeviceNSColor(color);
}

View file

@ -4,7 +4,7 @@
#include "shell/browser/ui/cocoa/delayed_native_view_host.h"
namespace atom {
namespace electron {
DelayedNativeViewHost::DelayedNativeViewHost(gfx::NativeView native_view)
: native_view_(native_view) {}
@ -18,4 +18,4 @@ void DelayedNativeViewHost::ViewHierarchyChanged(
Attach(native_view_);
}
} // namespace atom
} // namespace electron

View file

@ -7,7 +7,7 @@
#include "ui/views/controls/native/native_view_host.h"
namespace atom {
namespace electron {
// Automatically attach the native view after the NativeViewHost is attached to
// a widget. (Attaching it directly would cause crash.)
@ -26,6 +26,6 @@ class DelayedNativeViewHost : public views::NativeViewHost {
DISALLOW_COPY_AND_ASSIGN(DelayedNativeViewHost);
};
} // namespace atom
} // namespace electron
#endif // SHELL_BROWSER_UI_COCOA_DELAYED_NATIVE_VIEW_HOST_H_

View file

@ -7,7 +7,7 @@
#include "ui/views/view.h"
namespace atom {
namespace electron {
class NativeWindow;
@ -28,6 +28,6 @@ class RootViewMac : public views::View {
DISALLOW_COPY_AND_ASSIGN(RootViewMac);
};
} // namespace atom
} // namespace electron
#endif // SHELL_BROWSER_UI_COCOA_ROOT_VIEW_MAC_H_

View file

@ -6,7 +6,7 @@
#include "shell/browser/native_window.h"
namespace atom {
namespace electron {
RootViewMac::RootViewMac(NativeWindow* window) : window_(window) {
set_owned_by_client();
@ -29,4 +29,4 @@ gfx::Size RootViewMac::GetMaximumSize() const {
return window_->GetMaximumSize();
}
} // namespace atom
} // namespace electron

View file

@ -7,7 +7,7 @@
#include "ui/views/views_delegate.h"
namespace atom {
namespace electron {
class ViewsDelegateMac : public views::ViewsDelegate {
public:
@ -25,6 +25,6 @@ class ViewsDelegateMac : public views::ViewsDelegate {
DISALLOW_COPY_AND_ASSIGN(ViewsDelegateMac);
};
} // namespace atom
} // namespace electron
#endif // SHELL_BROWSER_UI_COCOA_VIEWS_DELEGATE_MAC_H_

View file

@ -7,7 +7,7 @@
#include "content/public/browser/context_factory.h"
#include "ui/views/widget/native_widget_mac.h"
namespace atom {
namespace electron {
ViewsDelegateMac::ViewsDelegateMac() {}
@ -40,4 +40,4 @@ ui::ContextFactoryPrivate* ViewsDelegateMac::GetContextFactoryPrivate() {
return content::GetContextFactoryPrivate();
}
} // namespace atom
} // namespace electron