Commit 8a3f57ff authored by Hui Yingst's avatar Hui Yingst Committed by Commit Bot

Add constants.js to hold all enums under pdf directory.

Under chrome/browser/resources/pdf directory, move existing enums into
constants.js. constants.js will be used to hold all future enums which
are added into this directory.

Change-Id: Ic3ed8e0d0cfa13e157c45ea640ec52dd5a67b90e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2056568Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Hui Yingst <nigi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743102}
parent 5ecaae03
......@@ -102,9 +102,9 @@
<include name="IDR_PDF_INDEX_CSS" file="pdf/index.css" allowexternalscript="true" type="BINDATA" />
<include name="IDR_PDF_MAIN_JS" file="pdf/main.js" type="BINDATA" preprocess="true" />
<include name="IDR_PDF_PDF_VIEWER_JS" file="pdf/pdf_viewer.js" type="BINDATA" />
<include name="IDR_PDF_CONSTANTS_JS" file="pdf/constants.js" type="BINDATA" />
<include name="IDR_PDF_CONTROLLER_JS" file="pdf/controller.js" type="BINDATA" />
<include name="IDR_PDF_TOOLBAR_MANAGER_JS" file="pdf/toolbar_manager.js" type="BINDATA" />
<include name="IDR_PDF_PDF_FITTING_TYPE_JS" file="pdf/pdf_fitting_type.js" type="BINDATA" />
<include name="IDR_PDF_VIEWPORT_JS" file="pdf/viewport.js" type="BINDATA" />
<include name="IDR_PDF_OPEN_PDF_PARAMS_PARSER_JS" file="pdf/open_pdf_params_parser.js" type="BINDATA" />
<include name="IDR_PDF_NAVIGATOR_JS" file="pdf/navigator.js" type="BINDATA" />
......
......@@ -25,14 +25,14 @@ js_library("browser_api") {
]
}
js_library("pdf_fitting_type") {
js_library("constants") {
}
js_library("gesture_detector") {
}
js_library("open_pdf_params_parser") {
deps = [ ":pdf_fitting_type" ]
deps = [ ":constants" ]
}
js_library("pdf_scripting_api") {
......@@ -43,8 +43,8 @@ js_library("viewport_scroller") {
js_library("viewport") {
deps = [
":constants",
":gesture_detector",
":pdf_fitting_type",
":zoom_manager",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:event_tracker.m",
......@@ -61,7 +61,7 @@ js_library("zoom_manager") {
}
js_library("metrics") {
deps = [ ":pdf_fitting_type" ]
deps = [ ":constants" ]
externs_list = [ "$externs_path/metrics_private.js" ]
}
......@@ -129,13 +129,13 @@ js_type_check("pdf_resources") {
deps = [
":annotation_tool",
":browser_api",
":constants",
":controller",
":gesture_detector",
":main",
":metrics",
":navigator",
":open_pdf_params_parser",
":pdf_fitting_type",
":pdf_scripting_api",
":pdf_viewer",
":toolbar_manager",
......
......@@ -10,5 +10,5 @@ export const FittingType = {
NONE: 'none',
FIT_TO_PAGE: 'fit-to-page',
FIT_TO_WIDTH: 'fit-to-width',
FIT_TO_HEIGHT: 'fit-to-height'
FIT_TO_HEIGHT: 'fit-to-height',
};
......@@ -89,7 +89,7 @@ js_library("viewer-toolbar-dropdown") {
js_library("viewer-zoom-toolbar") {
deps = [
":viewer-zoom-button",
"..:pdf_fitting_type",
"..:constants",
"//ui/webui/resources/js:assert.m",
]
}
......
......@@ -8,7 +8,7 @@ import './viewer-zoom-button.js';
import {assert} from 'chrome://resources/js/assert.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {FittingType} from '../pdf_fitting_type.js';
import {FittingType} from '../constants.js';
/**
* @typedef {{
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {FittingType} from './pdf_fitting_type.js';
import {FittingType} from './constants.js';
/**
* Handles events specific to the PDF viewer and logs the corresponding metrics.
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {FittingType} from './pdf_fitting_type.js';
import {FittingType} from './constants.js';
/**
* Parses the open pdf parameters passed in the url to set initial viewport
......
......@@ -9,6 +9,7 @@ import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js';
import {$, hasKeyModifiers, isRTL} from 'chrome://resources/js/util.m.js';
import {BrowserApi} from './browser_api.js';
import {FittingType} from './constants.js';
import {ContentController, InkController, MessageData, PluginController, PrintPreviewParams} from './controller.js';
import {Bookmark} from './elements/viewer-bookmark.js';
import {FitToChangedEvent} from './elements/viewer-zoom-toolbar.js';
......@@ -16,7 +17,6 @@ import {GestureDetector} from './gesture_detector.js';
import {PDFMetrics} from './metrics.js';
import {NavigatorDelegate, PdfNavigator} from './navigator.js';
import {OpenPdfParamsParser} from './open_pdf_params_parser.js';
import {FittingType} from './pdf_fitting_type.js';
import {DeserializeKeyEvent, LoadState, SerializeKeyEvent} from './pdf_scripting_api.js';
import {ToolbarManager} from './toolbar_manager.js';
import {LayoutOptions, Point, Viewport} from './viewport.js';
......
......@@ -6,7 +6,7 @@ import {assert} from 'chrome://resources/js/assert.m.js';
import {EventTracker} from 'chrome://resources/js/event_tracker.m.js';
import {$} from 'chrome://resources/js/util.m.js';
import {FittingType} from './pdf_fitting_type.js';
import {FittingType} from './constants.js';
import {InactiveZoomManager, ZoomManager} from './zoom_manager.js';
/**
......
......@@ -345,6 +345,7 @@ void SetupPrintPreviewPlugin(content::WebUIDataSource* source) {
int id;
} kPdfResources[] = {
{"pdf/browser_api.js", IDR_PDF_BROWSER_API_JS},
{"pdf/constants.js", IDR_PDF_CONSTANTS_JS},
{"pdf/controller.js", IDR_PDF_CONTROLLER_JS},
{"pdf/elements/icons.js", IDR_PDF_ICONS_JS},
{"pdf/elements/shared-vars.js", IDR_PDF_SHARED_VARS_JS},
......@@ -373,7 +374,6 @@ void SetupPrintPreviewPlugin(content::WebUIDataSource* source) {
{"pdf/metrics.js", IDR_PDF_METRICS_JS},
{"pdf/navigator.js", IDR_PDF_NAVIGATOR_JS},
{"pdf/open_pdf_params_parser.js", IDR_PDF_OPEN_PDF_PARAMS_PARSER_JS},
{"pdf/pdf_fitting_type.js", IDR_PDF_PDF_FITTING_TYPE_JS},
{"pdf/pdf_scripting_api.js", IDR_PDF_PDF_SCRIPTING_API_JS},
{"pdf/pdf_viewer.js", IDR_PDF_PDF_VIEWER_JS},
{"pdf/toolbar_manager.js", IDR_PDF_TOOLBAR_MANAGER_JS},
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {FittingType} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_fitting_type.js';
import {FittingType} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/constants.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {createBookmarksForTest} from './test_util.js';
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {FittingType} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/constants.js';
import {PDFMetrics} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/metrics.js';
import {FittingType} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_fitting_type.js';
chrome.test.runTests(function() {
'use strict';
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {FittingType} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/constants.js';
import {OpenPdfParamsParser} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/open_pdf_params_parser.js';
import {FittingType} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_fitting_type.js';
import {PDFScriptingAPI} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_scripting_api.js';
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {FittingType} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_fitting_type.js';
import {FittingType} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/constants.js';
import {Viewport} from 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/viewport.js';
import {getZoomableViewport, MockDocumentDimensions, MockSizer, MockViewportChangedCallback, MockWindow} from './test_util.js';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment