Rename hard-coded application names in code

This commit is contained in:
Cheng Zhao 2015-04-14 15:55:41 +08:00
parent c6c305a827
commit 2d8d328f02
13 changed files with 26 additions and 30 deletions

View file

@ -9,6 +9,7 @@
#include "atom/browser/native_window.h" #include "atom/browser/native_window.h"
#include "atom/browser/window_list.h" #include "atom/browser/window_list.h"
#include "atom/common/atom_version.h" #include "atom/common/atom_version.h"
#include "brightray/common/application_info.h"
namespace atom { namespace atom {
@ -31,11 +32,11 @@ void Browser::ClearRecentDocuments() {
} }
std::string Browser::GetExecutableFileVersion() const { std::string Browser::GetExecutableFileVersion() const {
return ATOM_VERSION_STRING; return brightray::GetApplicationVersion();
} }
std::string Browser::GetExecutableFileProductName() const { std::string Browser::GetExecutableFileProductName() const {
return "Atom-Shell"; return brightray::GetApplicationName();
} }
} // namespace atom } // namespace atom

View file

@ -4,13 +4,13 @@
#include "atom/browser/browser.h" #include "atom/browser/browser.h"
#import "atom/browser/mac/atom_application.h" #include "atom/browser/mac/atom_application.h"
#import "atom/browser/mac/atom_application_delegate.h" #include "atom/browser/mac/atom_application_delegate.h"
#include "atom/browser/native_window.h" #include "atom/browser/native_window.h"
#include "atom/browser/window_list.h" #include "atom/browser/window_list.h"
#import "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h"
#import "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "brightray/common/application_info.h"
namespace atom { namespace atom {
@ -27,15 +27,11 @@ void Browser::ClearRecentDocuments() {
} }
std::string Browser::GetExecutableFileVersion() const { std::string Browser::GetExecutableFileVersion() const {
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary; return brightray::GetApplicationVersion();
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
return base::SysNSStringToUTF8(version);
} }
std::string Browser::GetExecutableFileProductName() const { std::string Browser::GetExecutableFileProductName() const {
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary; return brightray::GetApplicationName();
NSString *version = [infoDictionary objectForKey:@"CFBundleName"];
return base::SysNSStringToUTF8(version);
} }
int Browser::DockBounce(BounceType type) { int Browser::DockBounce(BounceType type) {

View file

@ -118,7 +118,7 @@ void Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
} }
void Browser::SetAppUserModelID(const std::string& name) { void Browser::SetAppUserModelID(const std::string& name) {
app_user_model_id_ = base::string16(L"atom-shell.app."); app_user_model_id_ = base::string16(L"electron.app.");
app_user_model_id_ += base::UTF8ToUTF16(name); app_user_model_id_ += base::UTF8ToUTF16(name);
SetCurrentProcessExplicitAppUserModelID(app_user_model_id_.c_str()); SetCurrentProcessExplicitAppUserModelID(app_user_model_id_.c_str());
} }
@ -142,7 +142,7 @@ std::string Browser::GetExecutableFileProductName() const {
return base::UTF16ToUTF8(version_info->product_name()); return base::UTF16ToUTF8(version_info->product_name());
} }
return "Atom-Shell"; return ATOM_PRODUCT_NAME;
} }
} // namespace atom } // namespace atom

View file

@ -75,16 +75,16 @@
<h2 style="-webkit-app-region: drag">Welcome to Electron</h2> <h2 style="-webkit-app-region: drag">Welcome to Electron</h2>
<p> <p>
To run your app with atom-shell, execute the following command under your To run your app with Electron, execute the following command under your
Console (or Terminal): Console (or Terminal):
</p> </p>
<script>document.write('<pre>' + command + '</pre>')</script> <script>document.write('<pre>' + command + '</pre>')</script>
<p> <p>
The <code>path-to-your-app</code> should be the path to your own atom-shell The <code>path-to-your-app</code> should be the path to your own Electron
app, you can read the <a href='https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md'>quick start</a> app, you can read the <a href='https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md'>quick start</a>
guide in atom-shell's <a href='https://github.com/atom/atom-shell/blob/master/docs'>docs</a> guide in Electron's <a href='https://github.com/atom/electron/blob/master/docs'>docs</a>
on how to write one. on how to write one.
</p> </p>

View file

@ -50,7 +50,7 @@ if (option.file && !option.webdriver) {
} catch(e) { } catch(e) {
if (e.code == 'MODULE_NOT_FOUND') { if (e.code == 'MODULE_NOT_FOUND') {
app.focus(); app.focus();
dialog.showErrorBox('Error opening app', 'The app provided is not a valid atom-shell app, please read the docs on how to write one:\nhttps://github.com/atom/atom-shell/tree/master/docs'); dialog.showErrorBox('Error opening app', 'The app provided is not a valid electron app, please read the docs on how to write one:\nhttps://github.com/atom/electron/tree/master/docs');
process.exit(1); process.exit(1);
} else { } else {
console.error('App threw an error when running', e); console.error('App threw an error when running', e);
@ -58,7 +58,7 @@ if (option.file && !option.webdriver) {
} }
} }
} else if (option.version) { } else if (option.version) {
console.log('v' + process.versions['atom-shell']); console.log('v' + process.versions['electron']);
process.exit(0); process.exit(0);
} else { } else {
require('./default_app.js'); require('./default_app.js');

View file

@ -1,6 +1,5 @@
{ {
"name": "atom-shell-default-app", "name": "electron",
"productName": "Electron Default App", "productName": "Electron",
"version": "0.1.0",
"main": "main.js" "main": "main.js"
} }

View file

@ -126,7 +126,7 @@ void NodeDebugger::SendConnectMessage() {
"Protocol-Version: 1\r\n" "Protocol-Version: 1\r\n"
"Embedding-Host: %s\r\n" "Embedding-Host: %s\r\n"
"%s: 0\r\n", "%s: 0\r\n",
v8::V8::GetVersion(), "Atom-Shell", kContentLength), true); v8::V8::GetVersion(), ATOM_PRODUCT_NAME, kContentLength), true);
} }
// static // static

View file

@ -64,7 +64,7 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name,
bool skip_system_crash_handler) { bool skip_system_crash_handler) {
EnableCrashDumping(product_name); EnableCrashDumping(product_name);
crash_keys_.SetKeyValue("prod", "Atom-Shell"); crash_keys_.SetKeyValue("prod", ATOM_PRODUCT_NAME);
crash_keys_.SetKeyValue("ver", version.c_str()); crash_keys_.SetKeyValue("ver", version.c_str());
upload_url_ = submit_url; upload_url_ = submit_url;

View file

@ -32,7 +32,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
NSMutableDictionary* parameters = NSMutableDictionary* parameters =
[NSMutableDictionary dictionaryWithCapacity:4]; [NSMutableDictionary dictionaryWithCapacity:4];
[parameters setValue:@"Atom-Shell" [parameters setValue:@ATOM_PRODUCT_NAME
forKey:@BREAKPAD_PRODUCT]; forKey:@BREAKPAD_PRODUCT];
[parameters setValue:base::SysUTF8ToNSString(product_name) [parameters setValue:base::SysUTF8ToNSString(product_name)
forKey:@BREAKPAD_PRODUCT_DISPLAY]; forKey:@BREAKPAD_PRODUCT_DISPLAY];

View file

@ -103,7 +103,7 @@ google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo(
custom_info_entries_.reserve(2 + upload_parameters_.size()); custom_info_entries_.reserve(2 + upload_parameters_.size());
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"prod", L"Atom-Shell")); L"prod", L"Electron"));
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry( custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"ver", base::UTF8ToWide(version).c_str())); L"ver", base::UTF8ToWide(version).c_str()));

View file

@ -73,7 +73,7 @@ int Main(const wchar_t* cmd) {
NULL); NULL);
cmd_line.AppendSwitch("no-window"); cmd_line.AppendSwitch("no-window");
cmd_line.AppendSwitchASCII("max-reports", "128"); cmd_line.AppendSwitchASCII("max-reports", "128");
cmd_line.AppendSwitchASCII("reporter", "atom-shell-crash-service"); cmd_line.AppendSwitchASCII("reporter", ATOM_PROJECT_NAME "-crash-service");
cmd_line.AppendSwitchNative("pipe-name", pipe_name); cmd_line.AppendSwitchNative("pipe-name", pipe_name);
breakpad::CrashService crash_service; breakpad::CrashService crash_service;

View file

@ -9,7 +9,7 @@
namespace brightray { namespace brightray {
std::string GetApplicationName() { std::string GetApplicationName() {
return "Atom-Shell"; return ATOM_PRODUCT_NAME;
} }
std::string GetApplicationVersion() { std::string GetApplicationVersion() {

View file

@ -72,7 +72,7 @@ window.confirm = (message, title='') ->
# But we do not support prompt(). # But we do not support prompt().
window.prompt = -> window.prompt = ->
throw new Error('prompt() is and will not be supported in atom-shell.') throw new Error('prompt() is and will not be supported.')
window.opener = window.opener =
postMessage: (message, targetOrigin='*') -> postMessage: (message, targetOrigin='*') ->