summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c37
-rw-r--r--desktop/browser.h30
2 files changed, 65 insertions, 2 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 21b6c8815..8df59eee7 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -106,7 +106,6 @@ static inline void browser_window_get_scrollbar_pos(struct browser_window *bw,
* \param horizontal Whether to get length of horizontal scrollbar
* \return the scrollbar's length
*/
-
static inline int browser_window_get_scrollbar_len(struct browser_window *bw,
bool horizontal)
{
@@ -116,6 +115,42 @@ static inline int browser_window_get_scrollbar_len(struct browser_window *bw,
return bw->height;
}
+
+/* exported interface, documented in browser.h */
+nserror
+browser_window_get_name(struct browser_window *bw, const char **out_name)
+{
+ assert(bw != NULL);
+
+ *out_name = bw->name;
+
+ return NSERROR_OK;
+}
+
+/* exported interface, documented in browser.h */
+nserror
+browser_window_set_name(struct browser_window *bw, const char *name)
+{
+ char *nname = NULL;
+
+ assert(bw != NULL);
+
+ if (name != NULL) {
+ nname = strdup(name);
+ if (nname == NULL) {
+ return NSERROR_NOMEM;
+ }
+ }
+
+ if (bw->name != NULL) {
+ free(bw->name);
+ }
+
+ bw->name = nname;
+
+ return NSERROR_OK;
+}
+
/* exported interface, documented in browser.h */
bool browser_window_redraw(struct browser_window *bw, int x, int y,
const struct rect *clip, const struct redraw_context *ctx)
diff --git a/desktop/browser.h b/desktop/browser.h
index 07faf10dc..a1ec37a4b 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -677,11 +677,39 @@ int browser_get_dpi(void);
nserror browser_window_debug_dump(struct browser_window *bw, FILE *f, enum content_debug op);
/**
- * set debug options on a window
+ * Set debug options on a window
+ *
* \param bw The browser window.
* \param op The debug operation type.
* \return NSERROR_OK on success or error code on faliure.
*/
nserror browser_window_debug(struct browser_window *bw, enum content_debug op);
+/**
+ * Obtain a browsing contexts name.
+ *
+ * The returned pointer is owned bu the browsing context and is only
+ * valid untill the next operation on that context.
+ * The returned name may be NULL if no name has been set.
+ * \todo This does not consider behaviour wrt frames
+ *
+ * \param bw The browser window.
+ * \param name recives result string.
+ * \return NSERROR_OK
+ */
+nserror browser_window_get_name(struct browser_window *bw, const char **name);
+
+/**
+ * Set a browsing contexts name.
+ *
+ * Changes a browsing contexts name to a copy of that passed and the
+ * value is not subsequently referenced.
+ *
+ * \param bw The browser window.
+ * \param name The name string to set.
+ * \return NSERROR_OK and the name is updated or NSERROR_NOMEM and the
+ * original name is untouched.
+ */
+nserror browser_window_set_name(struct browser_window *bw, const char *name);
+
#endif