pub trait SiteHooks: Sync {
Show 26 methods
// Provided methods
fn fetch_is_special(&self, _method: &str, _full_url: &str) -> bool { ... }
fn fetch_rewrite_request(
&self,
url: &str,
_body: &[u8],
) -> (String, Option<Vec<u8>>) { ... }
fn fetch_on_response(&self, _raw: &mut Vec<u8>) { ... }
fn is_streaming_url(&self, _host: &str, _path: &str) -> bool { ... }
fn user_agent(&self, _host: &str) -> Option<&'static str> { ... }
fn offline_page(
&self,
_host: &str,
_path: &str,
_is_https: bool,
_is_post: bool,
_post_body: &str,
) -> Option<String> { ... }
fn rewrite_response(
&self,
_host: &str,
_path: &str,
_is_https: bool,
body: String,
) -> String { ... }
fn load_failed_page(
&self,
_host: &str,
_path: &str,
_is_https: bool,
_err: &str,
) -> Option<String> { ... }
fn patch_script(&self, _url: &str, _text: &mut String) { ... }
fn load_settle_ms(&self, _host: &str) -> Option<u64> { ... }
fn is_dark_host(&self, _host: &str) -> bool { ... }
fn page_tick(
&self,
_url_with_hash: &str,
_frame_depth: u32,
_js: &mut dyn Any,
) { ... }
fn initial_page(&self) -> (&'static str, &'static str) { ... }
fn resolve_redirect_link(&self, _href: &str) -> Option<String> { ... }
fn default_bookmarks(&self) -> Vec<(&'static str, &'static str)> { ... }
fn omnibox_prefix_suggestion(&self, _q: &str) -> Option<(String, String)> { ... }
fn search_suggestion_url(&self, s: &str) -> String { ... }
fn navigate_shortcut(&self, _input: &str) -> Option<(String, String)> { ... }
fn default_search(&self, _input: &str) -> Option<(String, String)> { ... }
fn search_suggestions(&self, _text: &str) -> Vec<String> { ... }
fn media_stream_begin(&self) { ... }
fn media_stream_end(&self) { ... }
fn media_stream_playback_head(&self, _ms: u64) { ... }
fn media_stream_refill(&self, _ms_id: usize) -> bool { ... }
fn map_embed(&self, _url: &str) -> Option<Embed> { ... }
fn map_tile_url(&self, _z: u32, _x: i64, _y: i64) -> String { ... }
}Expand description
サイト別の対応の差し込み口。既定の実装は何もしない。
Provided Methods§
Sourcefn fetch_is_special(&self, _method: &str, _full_url: &str) -> bool
fn fetch_is_special(&self, _method: &str, _full_url: &str) -> bool
この要求は、要求・応答に手を入れる対象か(YouTube の SABR: googlevideo への POST)。
Sourcefn fetch_rewrite_request(
&self,
url: &str,
_body: &[u8],
) -> (String, Option<Vec<u8>>)
fn fetch_rewrite_request( &self, url: &str, _body: &[u8], ) -> (String, Option<Vec<u8>>)
対象の要求の URL と本文を整える。(使う URL, 差し替えた本文)。本文を変えなければ None。
Sourcefn fetch_on_response(&self, _raw: &mut Vec<u8>)
fn fetch_on_response(&self, _raw: &mut Vec<u8>)
対象の要求の応答を見る(記録・警告)。
Sourcefn is_streaming_url(&self, _host: &str, _path: &str) -> bool
fn is_streaming_url(&self, _host: &str, _path: &str) -> bool
動画のストリーミングの取得か(取得全体の上限から外す対象)。
Sourcefn user_agent(&self, _host: &str) -> Option<&'static str>
fn user_agent(&self, _host: &str) -> Option<&'static str>
このホストへの既定の User-Agent(None なら既定の AtmOS/1.0)。
Sourcefn offline_page(
&self,
_host: &str,
_path: &str,
_is_https: bool,
_is_post: bool,
_post_body: &str,
) -> Option<String>
fn offline_page( &self, _host: &str, _path: &str, _is_https: bool, _is_post: bool, _post_body: &str, ) -> Option<String>
リンクが下がっているときの代わりのページ。
Sourcefn rewrite_response(
&self,
_host: &str,
_path: &str,
_is_https: bool,
body: String,
) -> String
fn rewrite_response( &self, _host: &str, _path: &str, _is_https: bool, body: String, ) -> String
受け取った本文を整える(検索結果ページの再生成など)。対象外なら本文をそのまま返す。
Sourcefn load_failed_page(
&self,
_host: &str,
_path: &str,
_is_https: bool,
_err: &str,
) -> Option<String>
fn load_failed_page( &self, _host: &str, _path: &str, _is_https: bool, _err: &str, ) -> Option<String>
取得に失敗したときの代わりのページ。
Sourcefn patch_script(&self, _url: &str, _text: &mut String)
fn patch_script(&self, _url: &str, _text: &mut String)
スクリプトの本文を取り込むときの差し替え(対象の URL だけ。web_engine/layout.rs)。
Sourcefn load_settle_ms(&self, _host: &str) -> Option<u64>
fn load_settle_ms(&self, _host: &str) -> Option<u64>
ページの背景の既定を暗くするホストか。
文書を complete にする(load を出す)前に、取得も DOM の変化も無い状態がこの時間(ms)続くのを待つサイト。
既定は None(仕様どおり、副資源の取得が済んだら出す。HTML §8.1.7)。
fn is_dark_host(&self, _host: &str) -> bool
Sourcefn page_tick(&self, _url_with_hash: &str, _frame_depth: u32, _js: &mut dyn Any)
fn page_tick(&self, _url_with_hash: &str, _frame_depth: u32, _js: &mut dyn Any)
1 フレームごとの呼び出し(診断の記録)。
js は JsRuntime(このモジュールが JS の型を知らなくて済むよう Any で渡す)。
Sourcefn initial_page(&self) -> (&'static str, &'static str)
fn initial_page(&self) -> (&'static str, &'static str)
ページを開く前の初期の表示 (ホスト, 題)。
Sourcefn resolve_redirect_link(&self, _href: &str) -> Option<String>
fn resolve_redirect_link(&self, _href: &str) -> Option<String>
リンク先が検索サイトの中継 URL なら、その先の URL(直接開く)。
Sourcefn default_bookmarks(&self) -> Vec<(&'static str, &'static str)>
fn default_bookmarks(&self) -> Vec<(&'static str, &'static str)>
既定のブックマーク (題, URL)(「AtmOS Home」の次に並べる)。
Sourcefn omnibox_prefix_suggestion(&self, _q: &str) -> Option<(String, String)>
fn omnibox_prefix_suggestion(&self, _q: &str) -> Option<(String, String)>
入力の先頭の語(yt など)による直接の候補 (題, URL)。
Sourcefn search_suggestion_url(&self, s: &str) -> String
fn search_suggestion_url(&self, s: &str) -> String
Web 検索の候補を開く URL。
入力の近道(g / yt など)。(ホスト, パス)(https で開く)。
Sourcefn default_search(&self, _input: &str) -> Option<(String, String)>
fn default_search(&self, _input: &str) -> Option<(String, String)>
入力が URL でも近道でもないときの既定の検索。(ホスト, パス)(https で開く)。
Sourcefn search_suggestions(&self, _text: &str) -> Vec<String>
fn search_suggestions(&self, _text: &str) -> Vec<String>
入力に対する検索の候補(模擬)。
Sourcefn media_stream_begin(&self)
fn media_stream_begin(&self)
MSE の再生を始める。
Sourcefn media_stream_end(&self)
fn media_stream_end(&self)
MSE の再生を終える・止める。
Sourcefn media_stream_playback_head(&self, _ms: u64)
fn media_stream_playback_head(&self, _ms: u64)
再生位置(ms)を伝える。
Sourcefn media_stream_refill(&self, _ms_id: usize) -> bool
fn media_stream_refill(&self, _ms_id: usize) -> bool
足りなくなった媒体を取り足す。起こしたら真。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".