Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: webkit/api/src/BackForwardListClientImpl.cpp

Issue 338041: Move a bunch of files into webkit/api/src... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/api/src/BackForwardListClientImpl.cpp
===================================================================
--- webkit/api/src/BackForwardListClientImpl.cpp (revision 30163)
+++ webkit/api/src/BackForwardListClientImpl.cpp (working copy)
@@ -1,101 +1,138 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
#include "config.h"
+#include "BackForwardListClientImpl.h"
#include "HistoryItem.h"
-#undef LOG
+#include "WebViewClient.h"
-#include "webkit/api/public/WebViewClient.h"
-#include "webkit/glue/back_forward_list_client_impl.h"
+// FIXME: Remove this once WebViewImpl moves out of glue/.
#include "webkit/glue/webview_impl.h"
-namespace webkit_glue {
+using namespace WebCore;
-const char kBackForwardNavigationScheme[] = "chrome-back-forward";
+namespace WebKit {
-BackForwardListClientImpl::BackForwardListClientImpl(WebViewImpl* webview)
- : webview_(webview) {
+const char backForwardNavigationScheme[] = "chrome-back-forward";
+
+BackForwardListClientImpl::BackForwardListClientImpl(WebViewImpl* webView)
+ : m_webView(webView)
+{
}
-BackForwardListClientImpl::~BackForwardListClientImpl() {
+BackForwardListClientImpl::~BackForwardListClientImpl()
+{
}
-void BackForwardListClientImpl::SetCurrentHistoryItem(
- WebCore::HistoryItem* item) {
- previous_item_ = current_item_;
- current_item_ = item;
+void BackForwardListClientImpl::SetCurrentHistoryItem(HistoryItem* item)
+{
+ m_previousItem = m_currentItem;
+ m_currentItem = item;
}
-WebCore::HistoryItem* BackForwardListClientImpl::GetPreviousHistoryItem()
- const {
- return previous_item_.get();
+HistoryItem* BackForwardListClientImpl::GetPreviousHistoryItem() const
+{
+ return m_previousItem.get();
}
-void BackForwardListClientImpl::addItem(PassRefPtr<WebCore::HistoryItem> item) {
- previous_item_ = current_item_;
- current_item_ = item;
+void BackForwardListClientImpl::addItem(PassRefPtr<HistoryItem> item)
+{
+ m_previousItem = m_currentItem;
+ m_currentItem = item;
- // If WebCore adds a new HistoryItem, it means this is a new navigation (ie,
- // not a reload or back/forward).
- webview_->ObserveNewNavigation();
+ // If WebCore adds a new HistoryItem, it means this is a new navigation (ie,
+ // not a reload or back/forward).
+ m_webView->ObserveNewNavigation();
- if (webview_->client())
- webview_->client()->didAddHistoryItem();
+ if (m_webView->client())
+ m_webView->client()->didAddHistoryItem();
}
-void BackForwardListClientImpl::goToItem(WebCore::HistoryItem* item) {
- previous_item_ = current_item_;
- current_item_ = item;
+void BackForwardListClientImpl::goToItem(HistoryItem* item)
+{
+ m_previousItem = m_currentItem;
+ m_currentItem = item;
- if (pending_history_item_ == item)
- pending_history_item_ = NULL;
+ if (m_pendingHistoryItem == item)
+ m_pendingHistoryItem = 0;
}
-WebCore::HistoryItem* BackForwardListClientImpl::currentItem() {
- return current_item_.get();
+HistoryItem* BackForwardListClientImpl::currentItem()
+{
+ return m_currentItem.get();
}
-WebCore::HistoryItem* BackForwardListClientImpl::itemAtIndex(int index) {
- if (!webview_->client())
- return NULL;
+HistoryItem* BackForwardListClientImpl::itemAtIndex(int index)
+{
+ if (!m_webView->client())
+ return 0;
- // Since we don't keep the entire back/forward list, we have no way to
- // properly implement this method. We return a dummy entry instead that we
- // intercept in our FrameLoaderClient implementation in case WebCore asks
- // to navigate to this HistoryItem.
+ // Since we don't keep the entire back/forward list, we have no way to
+ // properly implement this method. We return a dummy entry instead that we
+ // intercept in our FrameLoaderClient implementation in case WebCore asks
+ // to navigate to this HistoryItem.
- // TODO(darin): We should change WebCore to handle history.{back,forward,go}
- // differently. It should perhaps just ask the FrameLoaderClient to perform
- // those navigations.
+ // FIXME: We should change WebCore to handle history.{back,forward,go}
+ // differently. It should perhaps just ask the FrameLoaderClient to
+ // perform those navigations.
- WebCore::String url_string = WebCore::String::format(
- "%s://go/%d", kBackForwardNavigationScheme, index);
+ String url_string = String::format(
+ "%s://go/%d", backForwardNavigationScheme, index);
- pending_history_item_ =
- WebCore::HistoryItem::create(url_string, WebCore::String(), 0.0);
- return pending_history_item_.get();
+ m_pendingHistoryItem =
+ HistoryItem::create(url_string, String(), 0.0);
+ return m_pendingHistoryItem.get();
}
-int BackForwardListClientImpl::backListCount() {
- if (!webview_->client())
- return 0;
+int BackForwardListClientImpl::backListCount()
+{
+ if (!m_webView->client())
+ return 0;
- return webview_->client()->historyBackListCount();
+ return m_webView->client()->historyBackListCount();
}
-int BackForwardListClientImpl::forwardListCount() {
- if (!webview_->client())
- return 0;
+int BackForwardListClientImpl::forwardListCount()
+{
+ if (!m_webView->client())
+ return 0;
- return webview_->client()->historyForwardListCount();
+ return m_webView->client()->historyForwardListCount();
}
-void BackForwardListClientImpl::close() {
- current_item_ = NULL;
- previous_item_ = NULL;
- pending_history_item_ = NULL;
+void BackForwardListClientImpl::close()
+{
+ m_currentItem = 0;
+ m_previousItem = 0;
+ m_pendingHistoryItem = 0;
}
-} // namespace webkit_glue
+} // namespace WebKit

Powered by Google App Engine
This is Rietveld 408576698