Index: chrome/browser/instant/local_ntp_source.cc |
diff --git a/chrome/browser/instant/local_omnibox_popup_source.cc b/chrome/browser/instant/local_ntp_source.cc |
similarity index 51% |
copy from chrome/browser/instant/local_omnibox_popup_source.cc |
copy to chrome/browser/instant/local_ntp_source.cc |
index 1b64fe9f51d73a802fd6d59746dc3358dd203ed6..11bce7f5ef1583bfee4f1505192ce4d15b078af0 100644 |
--- a/chrome/browser/instant/local_omnibox_popup_source.cc |
+++ b/chrome/browser/instant/local_ntp_source.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/instant/local_omnibox_popup_source.h" |
+#include "chrome/browser/instant/local_ntp_source.h" |
#include "base/logging.h" |
#include "base/memory/ref_counted_memory.h" |
@@ -11,37 +11,47 @@ |
#include "content/public/common/content_client.h" |
#include "googleurl/src/gurl.h" |
#include "grit/browser_resources.h" |
+#include "grit/ui_resources.h" |
#include "net/url_request/url_request.h" |
namespace { |
-const char kHTMLFilename[] = "local-omnibox-popup.html"; |
-const char kJsFilename[] = "local-omnibox-popup.js"; |
-const char kCSSFilename[] = "local-omnibox-popup.css"; |
+const char kHTMLFilename[] = "local-ntp.html"; |
+const char kJsFilename[] = "local-ntp.js"; |
samarth
2013/03/18 22:09:19
nit: kJSFilename
jeremycho
2013/03/18 23:18:52
Done.
|
+const char kCSSFilename[] = "local-ntp.css"; |
+const char kCloseBarFilename[] = "images/close_bar.png"; |
+const char kCloseBarHoverFilename[] = "images/close_bar_hover.png"; |
+const char kCloseBarActiveFilename[] = "images/close_bar_active.png"; |
} // namespace |
-LocalOmniboxPopupSource::LocalOmniboxPopupSource() { |
+LocalNTPSource::LocalNTPSource() { |
} |
-LocalOmniboxPopupSource::~LocalOmniboxPopupSource() { |
+LocalNTPSource::~LocalNTPSource() { |
} |
-std::string LocalOmniboxPopupSource::GetSource() { |
- return chrome::kChromeSearchLocalOmniboxPopupHost; |
+std::string LocalNTPSource::GetSource() { |
+ return chrome::kChromeSearchLocalNTPHost; |
} |
-void LocalOmniboxPopupSource::StartDataRequest( |
+void LocalNTPSource::StartDataRequest( |
const std::string& path, |
bool is_incognito, |
const content::URLDataSource::GotDataCallback& callback) { |
int identifier = -1; |
if (path == kHTMLFilename) { |
- identifier = IDR_LOCAL_OMNIBOX_POPUP_HTML; |
+ identifier = IDR_LOCAL_NTP_HTML; |
} else if (path == kJsFilename) { |
- identifier = IDR_LOCAL_OMNIBOX_POPUP_JS; |
+ identifier = IDR_LOCAL_NTP_JS; |
} else if (path == kCSSFilename) { |
- identifier = IDR_LOCAL_OMNIBOX_POPUP_CSS; |
+ identifier = IDR_LOCAL_NTP_CSS; |
+ } else if (path == kCloseBarFilename) { |
+ identifier = IDR_CLOSE_BAR; |
+ } else if (path == kCloseBarHoverFilename) { |
+ identifier = IDR_CLOSE_BAR_H; |
+ } else if (path == kCloseBarActiveFilename) { |
+ identifier = IDR_CLOSE_BAR_P; |
} else { |
callback.Run(NULL); |
return; |
@@ -52,7 +62,7 @@ void LocalOmniboxPopupSource::StartDataRequest( |
callback.Run(response); |
} |
-std::string LocalOmniboxPopupSource::GetMimeType( |
+std::string LocalNTPSource::GetMimeType( |
const std::string& path) const { |
if (path == kHTMLFilename) |
return "text/html"; |
@@ -60,18 +70,23 @@ std::string LocalOmniboxPopupSource::GetMimeType( |
return "application/javascript"; |
if (path == kCSSFilename) |
return "text/css"; |
+ if (path == kCloseBarFilename || path == kCloseBarHoverFilename || |
+ path == kCloseBarActiveFilename) |
+ return "image/png"; |
return ""; |
} |
-bool LocalOmniboxPopupSource::ShouldServiceRequest( |
+bool LocalNTPSource::ShouldServiceRequest( |
const net::URLRequest* request) const { |
- DCHECK(request->url().host() == chrome::kChromeSearchLocalOmniboxPopupHost); |
+ DCHECK_EQ(request->url().host(), chrome::kChromeSearchLocalNTPHost); |
if (request->url().SchemeIs(chrome::kChromeSearchScheme)) { |
DCHECK(StartsWithASCII(request->url().path(), "/", true)); |
std::string filename = request->url().path().substr(1); |
return filename == kHTMLFilename || filename == kJsFilename || |
- filename == kCSSFilename; |
+ filename == kCSSFilename || filename == kCloseBarFilename || |
+ filename == kCloseBarHoverFilename || |
+ filename == kCloseBarActiveFilename; |
} |
return false; |
} |