文件在:frameworks\base\core\java\android\webkit
CallbackProxy:
这是一个继承自Handle的类,用来实现UI和WebViewCore之间交换的桥梁.
它里面定义了很多函数,这些函数里面基本上都只是完成了一个sendmessage的作用.它将message发送给自身的HandleMessage().然后按照类型再进去分发.
它定义了一些事件ID:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    // Message Ids
    private static final int PAGE_STARTED         = 100;
    private static final int RECEIVED_ICON        = 101;
    private static final int RECEIVED_TITLE       = 102;
    private static final int OVERRIDE_URL         = 103;
    private static final int AUTH_REQUEST         = 104;
    private static final int SSL_ERROR            = 105;
    private static final int PROGRESS             = 106;
    private static final int UPDATE_VISITED       = 107;
    private static final int LOAD_RESOURCE        = 108;
    private static final int CREATE_WINDOW        = 109;
    private static final int CLOSE_WINDOW         = 110;
    private static final int SAVE_PASSWORD        = 111;
    private static final int JS_ALERT             = 112;
    private static final int JS_CONFIRM           = 113;
    private static final int JS_PROMPT            = 114;
    private static final int JS_UNLOAD            = 115;
    private static final int ASYNC_KEYEVENTS      = 116;
    private static final int TOO_MANY_REDIRECTS   = 117;
    private static final int DOWNLOAD_FILE        = 118;
    private static final int REPORT_ERROR         = 119;
    private static final int RESEND_POST_DATA     = 120;
    private static final int PAGE_FINISHED        = 121;
    private static final int REQUEST_FOCUS        = 122;
    private static final int SCALE_CHANGED        = 123;
    private static final int RECEIVED_CERTIFICATE = 124;
    private static final int SWITCH_OUT_HISTORY   = 125;

这里的每个ID都在HandleMessage()里做了相应的处理.

先看看第一个吧:PAGE_STARTED
这个应该是开始load page了,而且跑到这个地方的page一定要是:iframes or framesets(这两个是什么?),其它形式的页面不会跑这个.
很奇怪onPageStarted的函数内容为空.WebViewClient里的函数也都是空了,查了一下,原来在BrowserActivity里面Override了:

    private final WebViewClient mWebViewClient = new WebViewClient()
    private final WebChromeClient mWebChromeClient = new WebChromeClient()

知道了这个,我们就可以想象从WebCore传上来某个事件,通过某些途径调用了CallbackProxy里处理函数.
然后再通过HandleMessage()来分发出去.分发的时候,主要有两个client:WebViewClien,WebChromeClient,这两个client分别定义了一些处理函数,并在BrowserActivity里实现了函数体.
分析到这里我们就能理解了为什么说CallbackProxy里沟通WebCore和UI Thread的桥梁了.

试了一个离线发布Blog的Firefox插件:ScribeFire,原来发布博客是这么简单的事情,以前都是登录到后台进行操作的,看来落后太多了。

————————————-华丽的分割线——————————————-
原来mpd可以播放ape,avi格式了,不知道还有其它格式吗?
创建数据库:mpd –create-db
将所有歌曲加到播放列表中去:mpc listall|mpc add
然后随便播放了,贴一个我写的播放的脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pjq@gentoo-pjq ~ $ cat /usr/local/bin/pp
#########################################################################
# Author: pengjianqing@gmail.com
# Created Time: Wed 04 Feb 2009 06:41:20 PM CST
# File Name: pp.sh
# Description:
#########################################################################
#!/bin/bash
echo  -n Input the Music name:
read  music
list=`mpc listall|cat -n|grep -i $music`
echo "$list"
#mpc listall|cat -n|grep -i $music|cut -b-7|while read music
#do
#echo mpc play $music
#mpc play $music&
#done
 
echo -n Input the Music Number:
read  music
name=`echo "$list"|grep $music`
echo "Now playing music:"
mpc play $music

使用方法:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77