aboutsummaryrefslogtreecommitdiff
path: root/src/background
diff options
context:
space:
mode:
Diffstat (limited to 'src/background')
-rw-r--r--src/background/controllers/operation.js2
-rw-r--r--src/background/usecases/command.js2
-rw-r--r--src/background/usecases/operation.js13
3 files changed, 16 insertions, 1 deletions
diff --git a/src/background/controllers/operation.js b/src/background/controllers/operation.js
index 1339006..aea85fc 100644
--- a/src/background/controllers/operation.js
+++ b/src/background/controllers/operation.js
@@ -37,6 +37,8 @@ export default class OperationController {
return this.operationInteractor.duplicate();
case operations.PAGE_SOURCE:
return this.operationInteractor.openPageSource();
+ case operations.PAGE_HOME:
+ return this.operationInteractor.openHome(operation.newTab);
case operations.ZOOM_IN:
return this.operationInteractor.zoomIn();
case operations.ZOOM_OUT:
diff --git a/src/background/usecases/command.js b/src/background/usecases/command.js
index f6ade43..0d21041 100644
--- a/src/background/usecases/command.js
+++ b/src/background/usecases/command.js
@@ -120,6 +120,6 @@ export default class CommandIndicator {
async urlOrSearch(keywords) {
let settings = await this.settingRepository.get();
- return urls.normalizeUrl(keywords, settings.search);
+ return urls.searchUrl(keywords, settings.search);
}
}
diff --git a/src/background/usecases/operation.js b/src/background/usecases/operation.js
index 74ea830..bf905be 100644
--- a/src/background/usecases/operation.js
+++ b/src/background/usecases/operation.js
@@ -1,5 +1,6 @@
import TabPresenter from '../presenters/tab';
import ConsolePresenter from '../presenters/console';
+import * as urls from '../../shared/urls';
const ZOOM_SETTINGS = [
0.33, 0.50, 0.66, 0.75, 0.80, 0.90, 1.00,
@@ -172,5 +173,17 @@ export default class OperationInteractor {
let tab = await this.tabPresenter.getCurrent();
return this.consolePresenter.hide(tab.id);
}
+
+ async openHome(newTab) {
+ let tab = await this.tabPresenter.getCurrent();
+ let result = await browser.browserSettings.homepageOverride.get({});
+ let us = urls.homepageUrls(result.value);
+ if (us.length === 1 && !newTab) {
+ return this.tabPresenter.open(us[0], tab.id);
+ }
+ for (let u of us) {
+ this.tabPresenter.create(u, { openerTabId: tab.id });
+ }
+ }
}