OLD | NEW |
---|---|
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "ChromiumBridge.h" | 6 #include "ChromiumBridge.h" |
7 | 7 |
8 #include "BitmapImage.h" | 8 #include "BitmapImage.h" |
9 #include "ClipboardUtilitiesChromium.h" | 9 #include "ClipboardUtilitiesChromium.h" |
10 #include "Cursor.h" | 10 #include "Cursor.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 #undef LOG | 27 #undef LOG |
28 #include "base/clipboard.h" | 28 #include "base/clipboard.h" |
29 #include "base/file_util.h" | 29 #include "base/file_util.h" |
30 #include "base/message_loop.h" | 30 #include "base/message_loop.h" |
31 #include "base/stats_counters.h" | 31 #include "base/stats_counters.h" |
32 #include "base/string_util.h" | 32 #include "base/string_util.h" |
33 #include "base/time.h" | 33 #include "base/time.h" |
34 #include "base/trace_event.h" | 34 #include "base/trace_event.h" |
35 #include "build/build_config.h" | 35 #include "build/build_config.h" |
36 #include "googleurl/src/url_util.h" | |
36 #include "net/base/mime_util.h" | 37 #include "net/base/mime_util.h" |
37 #if USE(V8) | 38 #if USE(V8) |
38 #include <v8.h> | 39 #include <v8.h> |
39 #endif | 40 #endif |
40 #include "webkit/glue/chrome_client_impl.h" | 41 #include "webkit/glue/chrome_client_impl.h" |
41 #include "webkit/glue/glue_util.h" | 42 #include "webkit/glue/glue_util.h" |
42 #include "webkit/glue/plugins/plugin_instance.h" | 43 #include "webkit/glue/plugins/plugin_instance.h" |
43 #include "webkit/glue/scoped_clipboard_writer_glue.h" | 44 #include "webkit/glue/scoped_clipboard_writer_glue.h" |
44 #include "webkit/glue/webcursor.h" | 45 #include "webkit/glue/webcursor.h" |
45 #include "webkit/glue/webkit_glue.h" | 46 #include "webkit/glue/webkit_glue.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 const char* extra) { | 515 const char* extra) { |
515 TRACE_EVENT_END(name, id, extra); | 516 TRACE_EVENT_END(name, id, extra); |
516 } | 517 } |
517 | 518 |
518 // URL ------------------------------------------------------------------------ | 519 // URL ------------------------------------------------------------------------ |
519 | 520 |
520 KURL ChromiumBridge::inspectorURL() { | 521 KURL ChromiumBridge::inspectorURL() { |
521 return webkit_glue::GURLToKURL(webkit_glue::GetInspectorURL()); | 522 return webkit_glue::GURLToKURL(webkit_glue::GetInspectorURL()); |
522 } | 523 } |
523 | 524 |
525 // Visited links -------------------------------------------------------------- | |
526 | |
527 WebCore::LinkHash ChromiumBridge::visitedLinkHash(const UChar* url, | |
528 unsigned length) { | |
529 url_canon::RawCanonOutput<2048> buffer; | |
macdome_gmail.com
2008/12/13 01:36:27
Pixels? Edict? Sound? Yes, we speak a crazy lan
| |
530 url_parse::Parsed parsed; | |
531 if (!url_util::Canonicalize(url, length, NULL, &buffer, &parsed)) | |
532 return false; // Invalid URLs are unvisited. | |
533 return webkit_glue::VisitedLinkHash(buffer.data(), buffer.length()); | |
534 } | |
535 | |
536 WebCore::LinkHash ChromiumBridge::visitedLinkHash( | |
537 const WebCore::KURL& base, | |
538 const WebCore::AtomicString& attributeURL) { | |
539 // Resolve the relative URL using googleurl and pass the absolute URL up to | |
540 // the embedder. We could create a GURL object from the base and resolve the | |
541 // relative URL that way, but calling the lower-level functions directly | |
542 // saves us the std::string allocation in most cases. | |
543 url_canon::RawCanonOutput<2048> buffer; | |
544 url_parse::Parsed parsed; | |
545 | |
546 WebCore::CString cstr = base.utf8String(); | |
547 if (!url_util::ResolveRelative(cstr.data(), cstr.length(), base.parsed(), | |
548 attributeURL.characters(), | |
549 attributeURL.length(), NULL, | |
550 &buffer, &parsed)) | |
551 return false; // Invalid resolved URL. | |
552 | |
553 return webkit_glue::VisitedLinkHash(buffer.data(), buffer.length()); | |
554 } | |
555 | |
556 bool ChromiumBridge::isLinkVisited(WebCore::LinkHash visitedLinkHash) { | |
557 return webkit_glue::IsLinkVisited(visitedLinkHash); | |
558 } | |
559 | |
524 // Widget --------------------------------------------------------------------- | 560 // Widget --------------------------------------------------------------------- |
525 | 561 |
526 void ChromiumBridge::widgetSetCursor(Widget* widget, const Cursor& cursor) { | 562 void ChromiumBridge::widgetSetCursor(Widget* widget, const Cursor& cursor) { |
527 ChromeClientImpl* chrome_client = ToChromeClient(widget); | 563 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
528 if (chrome_client) | 564 if (chrome_client) |
529 chrome_client->SetCursor(WebCursor(cursor.impl())); | 565 chrome_client->SetCursor(WebCursor(cursor.impl())); |
530 } | 566 } |
531 | 567 |
532 void ChromiumBridge::widgetSetFocus(Widget* widget) { | 568 void ChromiumBridge::widgetSetFocus(Widget* widget) { |
533 ChromeClientImpl* chrome_client = ToChromeClient(widget); | 569 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
534 if (chrome_client) | 570 if (chrome_client) |
535 chrome_client->focus(); | 571 chrome_client->focus(); |
536 } | 572 } |
537 | 573 |
538 // Link history --------------------------------------------------------------- | |
539 | |
540 bool ChromiumBridge::isLinkVisited(LinkHash) { | |
541 // NOT IMPLEMENTED | |
542 // http://code.google.com/p/chromium/issues/detail?id=5401 | |
543 return false; | |
544 } | |
545 | |
546 } // namespace WebCore | 574 } // namespace WebCore |
OLD | NEW |