Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1409 | 1409 |
| 1410 WebViewDelegate* d = GetView()->GetDelegate(); | 1410 WebViewDelegate* d = GetView()->GetDelegate(); |
| 1411 if (d) | 1411 if (d) |
| 1412 d->UserMetricsRecordAction(L"Redo"); | 1412 d->UserMetricsRecordAction(L"Redo"); |
| 1413 } | 1413 } |
| 1414 | 1414 |
| 1415 void WebFrameImpl::ClearSelection() { | 1415 void WebFrameImpl::ClearSelection() { |
| 1416 frame()->selection()->clear(); | 1416 frame()->selection()->clear(); |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 bool WebFrameImpl::HasSelection() { | |
| 1420 // frame()->selection()->isNone() never returns true. | |
| 1421 return (frame()->selection()->start() != | |
|
M-A Ruel
2009/06/02 16:15:09
Why the test here is different that the one in Get
Sverrir
2009/06/02 17:19:58
Even when there is no selection the range is non-n
M-A Ruel
2009/06/02 18:27:40
I guess it's fine. GetSelection() wants to return
| |
| 1422 frame()->selection()->end()); | |
| 1423 } | |
| 1424 | |
| 1419 std::string WebFrameImpl::GetSelection(bool as_html) { | 1425 std::string WebFrameImpl::GetSelection(bool as_html) { |
| 1420 RefPtr<Range> range = frame()->selection()->toNormalizedRange(); | 1426 RefPtr<Range> range = frame()->selection()->toNormalizedRange(); |
| 1421 if (!range.get()) | 1427 if (!range.get()) |
| 1422 return std::string(); | 1428 return std::string(); |
| 1423 | 1429 |
| 1424 if (as_html) { | 1430 if (as_html) { |
| 1425 String markup = WebCore::createMarkup(range.get(), 0); | 1431 String markup = WebCore::createMarkup(range.get(), 0); |
| 1426 return webkit_glue::StringToStdString(markup); | 1432 return webkit_glue::StringToStdString(markup); |
| 1427 } else { | 1433 } else { |
| 1428 return webkit_glue::StringToStdString(range->text()); | 1434 return webkit_glue::StringToStdString(range->text()); |
| 1429 } | 1435 } |
| 1430 } | 1436 } |
| 1431 | 1437 |
| 1438 std::string WebFrameImpl::GetFullPageHtml() { | |
| 1439 return webkit_glue::StringToStdString(createFullMarkup(frame_->document())); | |
| 1440 } | |
| 1441 | |
| 1432 void WebFrameImpl::CreateFrameView() { | 1442 void WebFrameImpl::CreateFrameView() { |
| 1433 ASSERT(frame_); // If frame_ doesn't exist, we probably didn't init properly. | 1443 ASSERT(frame_); // If frame_ doesn't exist, we probably didn't init properly. |
| 1434 | 1444 |
| 1435 WebCore::Page* page = frame_->page(); | 1445 WebCore::Page* page = frame_->page(); |
| 1436 DCHECK(page); | 1446 DCHECK(page); |
| 1437 | 1447 |
| 1438 DCHECK(page->mainFrame() != NULL); | 1448 DCHECK(page->mainFrame() != NULL); |
| 1439 | 1449 |
| 1440 bool is_main_frame = frame_ == page->mainFrame(); | 1450 bool is_main_frame = frame_ == page->mainFrame(); |
| 1441 if (is_main_frame && frame_->view()) | 1451 if (is_main_frame && frame_->view()) |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1899 return password_listeners_.get(input_element); | 1909 return password_listeners_.get(input_element); |
| 1900 } | 1910 } |
| 1901 | 1911 |
| 1902 void WebFrameImpl::ClearPasswordListeners() { | 1912 void WebFrameImpl::ClearPasswordListeners() { |
| 1903 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); | 1913 for (PasswordListenerMap::iterator iter = password_listeners_.begin(); |
| 1904 iter != password_listeners_.end(); ++iter) { | 1914 iter != password_listeners_.end(); ++iter) { |
| 1905 delete iter->second; | 1915 delete iter->second; |
| 1906 } | 1916 } |
| 1907 password_listeners_.clear(); | 1917 password_listeners_.clear(); |
| 1908 } | 1918 } |
| OLD | NEW |